dousuohe5882
2016-07-30 23:04
浏览 41

如何将Samba服务器位置用于GOPATH?

I am trying to set my GOPATH to a shared network folder. When I enter

export GOPATH=smb://path/to/shared/folder

I get:

go: GOPATH entry is relative; must be absolute path: "smb".
Run 'go help gopath' for usage.

I've also tried to prefix the path w/ "/" but then it tries to make a folder in root.

thx!

图片转代码服务由CSDN问答提供 功能建议

我正在尝试将GOPATH设置为共享网络文件夹。 输入

  export GOPATH = smb:// path / to / shared / folder 
   
 
 

  go:GOPATH条目是相对的; 必须为绝对路径:“ smb”。
运行'go help gopath'以供使用。
   
 
 

我还尝试为路径加上“ /”作为前缀

thx!

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dsuxcxqep31023992 2016-07-31 03:43
    已采纳

    there is only one solution for this:
    Map ( mount) a Samba server file path as a Local Disk Drive ( local path), then set GOPATH to this local path:

    Mounting SMB share on local folder by using smbmount command (smbmount is deprecated):

    smbmount //ipadd/sharename /mountpoint –o  username=userid,workgroup=workgroupname
    

    Example :

    smbmount //192.168.0.1/share1 /mnt –o username=steev,workgroup=test
    

    Mounting SMB share by using mount command

    mount –t smbfs ipadd:/sharename /mountpoint –o username=userid,workgroup=workgroupname
    

    Or

    mount –t smbfs //ipadd/sharename /mountpoint –o username=userid,workgroup=workgroupname
    

    Example :

    mount –t smbfs 192.168.0.1:/share1 /mnt –o username=surendra,workgroup=test
    

    ref:
    http://www.linuxnix.com/8-ways-to-mount-smbfs-samba-file-system-in-linux/

    https://askubuntu.com/questions/232998/how-do-i-install-smbmount http://www.howtogeek.com/116309/use-ubuntus-public-folder-to-easily-share-files-between-computers/
    and for Windows: https://serverfault.com/questions/6079/how-can-i-mount-an-ftp-to-a-drive-letter-in-windows

    已采纳该答案
    打赏 评论
  • doutinghou6980 2016-07-31 03:36

    You need to mount the Samba share to a folder on your machine:

    $ mkdir /mnt/samba
    $ smbmount smb://path/to/share /mnt/samba
    

    Of course you may need to use switches on the smbmount command to provide username, password, workgroup, etc., depending on the configuration of the Samba share you're trying to access. Once you've mounted the share you can then do

    $ export GOPATH=/mnt/samba

    And as far as Go is concerned the files in the Samba share will be located on your local machine.

    打赏 评论

相关推荐 更多相似问题