go build can't find a revision
go build tags
go build package
go build options
go build -ldflags
go build executable
go build example
go build command example
I developed a repo on computer A and created a go.mod/go.sum that I checked in.
I pull that repo with the go.mod/go.sum files on computer B, but when I try to build the program, the module constraints can't be satisfied.
$ go build go: finding github.ibm.com/kms/key-protect-client v0.1.5 go: finding golang.org/x/tools v0.0.0-20180221164845-07fd8470d635 go: firstname.lastname@example.org: unknown revision v0.1.5 go: error loading module requirements
The repo that is failing is a private repo, and for some reason it doesn't get downloaded to the module cache. On another computer, the dependencies are downloaded and the build succeeds. I am building another private repo in that same domain, so I know that my github credentials give me access to these repos. But for some reason, the go module system can't get to the dependent repo.
I cannot find more information how to debug this.
Possible solutions for golang unknown revision if you are using private repository:
git config --global url."ssh://git@yourserver".insteadOf "https://yourserver"
Check your git repository permissions
go - The Go Programming Language, What the go command does depends on whether we run it for a "normal" package or for the special "main" package. For packages. go build� Because building a single package, like with go build or go test, can easily tell when something is missing and needs to be added, but not when something can safely be removed. Removing a dependency can only be done after checking all packages in a module, and all possible build tag combinations for those packages.
In case getting
"Error": "unknown revision ..."
"Error": "invalid version ..."
Make sure that you did not specify hash of PR (pull request). Even a merged PR might be wrong.
Look for the commit hash in the github repo
/commits, but not under
See more info here: golang/go#31191 explicitly filters out these kind of commits.
How To Build and Install Go Programs, Building packages. Building a Go package involves at least two steps, compiling the .go files then packing the results into an archive. In this� Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.Provide details and share your research! But avoid …. Asking for help, clarification, or responding to other answers.
Problem is related to cmd/go not being aware of git identities and assuming there is only one articulated in the .gitconfig file.
Work-around: have a set of git identities ready to replace global .gitconfig when you need to work with that git identity and are dealing with cmd/go tools that update the module file.
What does go build build? (go build vs. go install), It helps to understand what commands will be execute while building a binary. ( This only shows commands and not execute it). go build -work sourcefile.go. print � Currently, only one tradesman is entering the industry for every four that leave. That means you can earn competitive pay at a young age—without worrying about student loan debt. Learn more about the industry and how you can build your career. Find out more
In line with some comments above -- I had this problem because my git was fried due to updating to Mojave... the highly upvoted response here (
xcode-select --install) got me past this error message Git is not working after macOS Mojave Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)
if you are having this problem make sure your
go status etc are working as expected.
How does the go build command work ?, You can output a binary file from a Go program or package using go build < package-name> (main package) or go build program/path.go� When you join us on an Expedition, you and your team will work directly alongside local go.build.love. partners and ministries to bring sustainable projects and solutions as we build stronger communities on top of water.
GoLang's go build command. In recent times google's golang is the , force rebuilding of packages that are already up-to-date. -n: print the commands but do not run them. -p n: the number of builds that can be run in� The 'go build' and 'go install' commands take a -buildmode argument which indicates which kind of object file is to be built. Currently supported values are: -buildmode=archive Build the listed non-main packages into .a files. Packages named main are ignored.
Getting started with Go. Installing Go on your system, setting…, go build: compiles the packages named by the import paths, along with their dependencies, the binary does not end up in $GOPATH/bin it gets created in the � For a full-featured online store with advanced payment options, various shipping methods and increased functionality, you’ll need to upgrade to the Ecommerce plan. Once you’ve upgraded, you can accept orders and build the ultimate shopping experience with features like Apple Pay, highlighted product sections and promotional coupons.
go-build(1) — golang-go — Debian testing — Debian Manpages, go build will compile a program into an executable file. To demonstrate, we will use a simple Hello World example main.go: package main import fmt func main() � Built just for your business, GoCanvas has thousands of mobile form apps to help you save time and money on data collection. Leave paper forms behind with GoCanvas.
- The error isn't that it can't find it, it is
unknown revision v0.1.5- meaning it did find it, but that git tag doesn't exist.
- @adrian, the tag exists in the repo, as its existence made it to the go.mod file on computer A. Just can't get to use it on computer B, and I would like to understand why. That whole private domain (github.ibm.com) does not get created in the mod cache, which I think is the reason why the tag can't be found on computer B.
- Not sure if it is possible with IBM's GitHub instance, but a potential solution can be found in the answer to this question on SO: stackoverflow.com/questions/53516358/… (using a GITHUB_TOKEN).
- @retgits it indeed has something to do with access: it is not picking up the right protocol, and I haven't found guidance how to control it inside the go build tool. There are multiple git identities on computer B and my local git config specialized for that repo doesn't seem to control the protocol, so it is using https where it needs to use the token.
- Can you clone github.ibm.com/kms/key-protect-client on computer B using git command line? If not, it sounds like it is more of a git problem than a go problem.
- In case it fails, try forcing on SSH with this one:
git config --global url."ssh://yourserver".insteadOf "yourserver"
- This is an abstract solution - can you write the actual steps/commands for the workaround?
- This post explains the process in more detail: thecodedself.com/Using-Multiple-Author-Identities-With-Git