去安装-Win10上的行为不同于osx或linux

I have GOPATH set to:

~/Projects/golang

On Linux, OSX and Win10. My code is under:

$GOPATH/src/bitbucket.org/user/project/sublib

with pkg in the appropriate parallel loacation. On Linux and OSX I can run go install in the sublib directory and the lib builds and gets installed in

$GOPATH/pkg/bitbucket.org/user/project/sublib.a

and everything imports fine. On Windows 10 however with the same rig, I need to supply the path when installing:

> go install bitbucket.org\user\project\sublib

which works, but the imports in main() (say) do not.

import (
    "net/http"

    "bitbucket.org/user/project/sublib"
    "github.com/gorilla/handlers"
    "github.com/gorilla/mux"
)

does not compile. What am I missing on Windows?

John@RATBONE C:\Users\John\Projects\golang\src\bitbucket.org\user\project\sublib> go env
set GOARCH=amd64
set GOBIN=C:\Users\john\Projects\golang\bin
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\john\Projects\golang
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
> go version
go version go1.9.2 windows/amd64

1个回答



已解决:GOPATH中的大小写错误(John vs. John)。 从来没有注意到它。 可能会影响go install但不会影响main()的构建吗?</ p>
</ div>

展开原文

原文

Solved: case error in GOPATH (john vs. John). Never noticed it. Odd that it affected go install but not go build of main()?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐