go build 不会将本地更改编译到 main
go build does not compile local changes into main
我比较新,go build 系统有点问题。
GO环境:
(base) ngadre-mbp:github.com ngadre$ go version
go version go1.14.5 darwin/amd64
(base) ngadre-mbp:github.com ngadre$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ngadre/Library/Caches/go-build"
GOENV="/Users/ngadre/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ngadre/Desktop/Workspace/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5g/59l0__050lg6p4hv1wv7mhw40000gn/T/go-build110012391=/tmp/go-build -gno-record-gcc-switches -fno-common"
我的目录结构如下:
pwd: /Users/ngadre/Desktop/Workspace/go/src/github.com
.
├── coredhcp
│ ├── LICENSE
│ ├── README.md
│ ├── cmds
│ │ ├── client
│ │ ├── coredhcp
│ │ └── coredhcp-generator
│ ├── config
│ │ ├── config.go
│ │ ├── config_test.go
│ │ └── errors.go
│ ├── go.mod
│ ├── go.sum
│ ├── handler
│ │ └── handler.go
│ ├── logger
│ │ └── logger.go
│ ├── plugins
│ │ ├── dns
│ │ ├── example
│ │ ├── file
│ │ ├── leasetime
│ │ ├── nbp
│ │ ├── netmask
│ │ ├── plugin.go
│ │ ├── range
│ │ ├── router
│ │ └── serverid
│ └── server
│ ├── handle.go
│ └── serve.go
├── go-immutable-radix
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── edges.go
│ ├── go.mod
│ ├── go.sum
│ ├── iradix.go
│ ├── iradix_test.go
│ ├── iter.go
│ ├── node.go
│ └── raw_iter.go
项目“coredhcp”和“go-immutable-radix”都是我使用git clone
我对“go-immutable-radix”项目做了一些更改并添加了日志,但是,我无法
将我的本地更改构建到使用此“go-immutable-radix”项目的“coredhcp”项目中。
go build cmds/coredhcp/main.go
关于如何通过 go build 将“A”项目中的本地更改编译到“X”项目中的任何建议。
如果您有另一个 go 模块的本地克隆版本,请使用 go.mod 中的 replace
指令(coredhcp 包的 go.mod )指向本地副本:
replace github.com/.../go-immutable-radix => ../go-immutable-radix
我比较新,go build 系统有点问题。
GO环境:
(base) ngadre-mbp:github.com ngadre$ go version
go version go1.14.5 darwin/amd64
(base) ngadre-mbp:github.com ngadre$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ngadre/Library/Caches/go-build"
GOENV="/Users/ngadre/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ngadre/Desktop/Workspace/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5g/59l0__050lg6p4hv1wv7mhw40000gn/T/go-build110012391=/tmp/go-build -gno-record-gcc-switches -fno-common"
我的目录结构如下:
pwd: /Users/ngadre/Desktop/Workspace/go/src/github.com
.
├── coredhcp
│ ├── LICENSE
│ ├── README.md
│ ├── cmds
│ │ ├── client
│ │ ├── coredhcp
│ │ └── coredhcp-generator
│ ├── config
│ │ ├── config.go
│ │ ├── config_test.go
│ │ └── errors.go
│ ├── go.mod
│ ├── go.sum
│ ├── handler
│ │ └── handler.go
│ ├── logger
│ │ └── logger.go
│ ├── plugins
│ │ ├── dns
│ │ ├── example
│ │ ├── file
│ │ ├── leasetime
│ │ ├── nbp
│ │ ├── netmask
│ │ ├── plugin.go
│ │ ├── range
│ │ ├── router
│ │ └── serverid
│ └── server
│ ├── handle.go
│ └── serve.go
├── go-immutable-radix
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── edges.go
│ ├── go.mod
│ ├── go.sum
│ ├── iradix.go
│ ├── iradix_test.go
│ ├── iter.go
│ ├── node.go
│ └── raw_iter.go
项目“coredhcp”和“go-immutable-radix”都是我使用git clone
我对“go-immutable-radix”项目做了一些更改并添加了日志,但是,我无法 将我的本地更改构建到使用此“go-immutable-radix”项目的“coredhcp”项目中。
go build cmds/coredhcp/main.go
关于如何通过 go build 将“A”项目中的本地更改编译到“X”项目中的任何建议。
如果您有另一个 go 模块的本地克隆版本,请使用 go.mod 中的 replace
指令(coredhcp 包的 go.mod )指向本地副本:
replace github.com/.../go-immutable-radix => ../go-immutable-radix