describe
When I clone GoAdminGroup/go-admin projectin github and run the project by the steps of README.MD file , I get this error
TEST-MBP:example TEST$ GO111MODULE=on go run main.go
go: downloading github.com/mattn/go-sqlite3 v1.11.0
go: extracting github.com/mattn/go-sqlite3 v1.11.0
go: finding github.com/mattn/go-sqlite3 v1.11.0
# runtime/internal/sys
/Users/TEST/go/src/runtime/internal/sys/stubs.go:16:30: undefined: StackGuardMultiplierDefault
Actually my /Users/TEST/go/src folder was cloned from https://github.com/golang/go/tree/release-branch.go1.13/src
Why StackGuardMultiplierDefault was undefined in /src/runtime/internal/sys/stubs.go
As per my understanding you cloned the Go source code from it's github and expecting it to work. It will not work.
You need to to follow Go guide Installing Go from source if you want to install it from the (github) source. Only cloning the repository is not enough, there are some required steps to be done after that.
Otherwise I suggest to install by using the available binary distributions installer.
Detailed explanation: the const StackGuardMultiplierDefault is not found because the file where the const declared does not exists (the zversion.go file). This particular file is only generated when àll.bash is executed (part of steps on installling Go from source).
Related
So,I recently started following a video tutorial and i am fairly new to golang and tried installing the forked version of bolt db using
$ go get go.etcd.io/bbolt/...
Note : I want to use this specific version
but i am getting an error which says
go: go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd#latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'
I read a few GitHub issues which say that go get is deprecated so how do I resolve this ?
I also tried few other things such as
go install go.etcd.io/bbolt/...
Go modules are today's standard. Especially if you are new to Go; do not spend time on material that do not use (and teach) them.
Run go mod init yourproject
in your project repository root directory. This will create go.mod file.
Once you have that you can either:
import go.etcd.io/bbolt in source code and then run go mod tidy. Go tool will find and add module to your dependencies (go.mod file). This is described in Getting started tutorial.
run go get go.etcd.io/bbolt directly, that will update dependencies too.
Using Go Modules series explains workflow in detail and will be helpful when converting commands from an outdated material.
I'm trying to install my package using go install but I get this error message when running the command go install github.com/JoaoDanielRufino/gcloc/cmd/gcloc#latest:
go install: github.com/JoaoDanielRufino/gcloc/cmd/gcloc#latest: module github.com/JoaoDanielRufino/gcloc#latest found (v1.0.0), but does not contain package github.com/JoaoDanielRufino/gcloc/cmd/gcloc
I want the executable name to be gcloc.
Here is the current source code: https://github.com/JoaoDanielRufino/gcloc
Note: I've already tried go clean -modcache but it didn't work
As the main function of this package isn't on its root, you should pass the directory of the main package on your command.
So, your command will be:
go install -v github.com/JoaoDanielRufino/gcloc/cmd#latest
I came across a similar issue when I was trying to use go install to install the cloudflare/cf-terraforming tool on my machine. The documentation for this tool is not clear on the installation and I had to dig around to get this to work
Basically #Jictyvoo answer above sums it up, if the path is pointing to anything other than directory where the main.go file is sitting I got the error
Command: go install github.com/cloudflare/cf-terraforming#latest v0.8.0#latest
go: github.com/cloudflare/cf-terraforming#latest: module
github.com/cloudflare/cf-terraforming#latest found (v0.8.0), but does not
contain package github.com/cloudflare/cf-terraforming
when I switched to the below it worked fine for me:
Command: go install -v github.com/cloudflare/cf-terraforming/cmd/cf-terraforming#latest
This worked for me after checking the repo and realising that the main.go file was sitting in the cmd/cf-terraforming subdirectory
I'm trying to make available a cli tool written in Go but I'm getting the following error when trying to install it using:
go install github.com/myuser/mytool#latest
The error:
go install: github.com/myuser/mytool#latest: module github.com/myuser/mytool#latest found (v0.0.1), but does not contain package github.com/myuser/mytool
I have created a v0.0.1 tag and added the binaries for release.
Also tried:
go get -u github.com/myuser/mytool
Then I get no output and the binary is not installed.
More Info:
go.mod:
module github.com/myuser/mytool
go 1.17
require github.com/fatih/color v1.13.0
require (
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1 // indirect
)
Go version:
go version go1.17.2 darwin/arm64
Obs: I can install any other tool on github in the same way as the above.
EDIT
Someone has voted to close the issue for lack of clarity. Would help if you could also be more clear and say what do you think I'm missing here.
My assumption would be that you didn't publish this as a package. check out this link for information on modules and publishing.
I have a shell script setup for one of my projects to upload it as a package, shown below:
!/bin/bash
git tag $1
git push origin $1
GOPROXY=proxy.golang.org go list -m github.com/myuser/mytool#$1
$1 refers to the first parameter of the script, which is the version number.
Im trying to rebuild a golang github repository to apply some minor changes.
The go application Im trying to modify is the following https://github.com/lian/msfs2020-go
Please use the provided github link to inspect the file tree.
I used the master branch and extracted it to /user/Documents/msfs2020-go-master
If I call go build from /user/Documents/msfs2020-go-master the output equals: no Go files in /user/Documents/msfs2020-go-master
I tried deleting the go.mod and recreating it with go mod init github.com/lian/msfs2020-go followed with a go mod tidy
but still no Go files in /user/Documents/msfs2020-go-master
Here the current go.mod
module github.com/lian/msfs2020-go
go 1.16
require github.com/gorilla/websocket v1.4.2
And here the go.sum
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
The master was build with 1.14 and Im using 1.16 golang.
All my test go applications/modules run/build/install fine at a "Hello World" developing level.
What did I do wrong? I gladly accept any input and will provide additional information's if requested.
The command go build builds the package in the current working directory. The command reports an error because there is not a package at the root of the repository.
Fix by building the package containing the command. Any of the following will work from the root of the repository:
go build ./vfrmap
or
cd vrfrmap
go build
or
go build github.com/lian/msfs2020-go/vfrmap
See also the file build-vfrmap.sh.
I'm new in Go language. I want to test some code in Go language some code in Go language by using this command go run main.go.
I have this error:
cannot find module providing package github.com/perlin-network/noise/crypto/ed25519
I tried to install it using:
go get github.com/perlin-network/noise/crypto/ed25519
I get this error:
go: finding github.com/perlin-network/noise/crypto/ed25519 latest
go: finding github.com/perlin-network/noise/crypto latest
go get github.com/perlin-network/noise/crypto/ed25519: no matching versions for query "latest"
I also have tried this:
go get -u github.com/perlin-network/noise
The error:
go: finding github.com/oasislabs/ed25519 latest
go: finding golang.org/x/lint latest
go: finding golang.org/x/xerrors latest
go: finding golang.org/x/crypto latest
go: github.com/oasislabs/ed25519#v0.0.0-20210505154701-76d8c688d86e: parsing go.mod: unexpected module path "github.com/oasisprotocol/ed25519"
go: finding golang.org/x/net latest
go get: error loading module requirements
Did I miss something?
This is currently mentioned in perlin-network/noise issue 287, since Aug. 2020, without any answer for now (Q2 2021).
An alternative would be to:
fork the repository perlin-network/noise
update the dependency in the fork me/noise
use go mod replace in your project, to switch repositories.
But all that suggests your own project uses go mod, so make sure to go init myproject first, in order to benefit from those dependencies management feature.
That way, no need to $GOPATH/src.