dsc56927 2017-11-11 20:22
浏览 32
已采纳

去安装-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条回答 默认 最新

  • douque2016 2017-11-12 23:24
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 微信小游戏反编译后,出现找不到分包的情况
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题