Closed ren-kun closed 6 years ago
You might be using an older version of go. You could try updating.
Type go version
to see the version you're on right now.
I see go version go1.9.3 windows/amd64
for mine
Sync.pool was introduced in go version 1.3
I uninstalled Go and tried it again. But i get this output for version:
go version xgcc (Ubuntu 4.9.3-0ubuntu4) 4.9.3 linux/amd64
Perhaps I missed a step?
Ahh.... I have two types of go's
sudo apt-get remove gccgo
worked and i had to rego the PATHs
I get:
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
Now, is that an error
Yeah, you can't download packages to the same place your root go files are installed.
So you need to set your GOPATH to something else, like ~/godata
So I change export PATH=$PATH:/usr/local/go/bin
to something like: export PATH=$PATH:/var/Something
You need to export GOPATH=/home/something
and all your downloaded packages and executeables will go there.
You also need to export PATH=$PATH;/home/something/bin/
Thanks!
Now i get:
can't load package: package .: no Go files in /folder/here
when building go
Can you go get github.com/bwmarrin/discordgo
Yes I did the command and it seems to have worked (No error returned)
Just "can't load package: package .: no Go files in /folder" still. when
"go build"
Make sure your terminal is in the right directory and that the package you're building has package main
at the top of all the go files if you want to build an executeable.
I will get the same error if I try to use go build
in my home directory, which contains no go files.
Usually when working on projects you will want to create them under your github name or something in your GOPATH.
So a good project directory would be something like
$GOPATH/src/github.com/yourname/project
Where is the right directory? For example I go get..
go get github.com/bwmarrin/discordgo go get github.com/joho/godotenv
where would i go to compile it? I think I am not trying to build an executable. Pardon if I can not post other git links here but I'm just trying to do follow "https://github.com/FactoKit/FactoCord"
When you go get github.com/FactoKit/FactoCord
it should build an executeable and place it in $GOPATH/bin
.
Otherwise you would have to
cd "$GOPATH/src/github.com/FactoKit/FactoCord"
go build
which would produce an executeable called FactoCord in the current directory.
So to run you would just type FactoCord
if $GOPATH/bin
is exported.
Ahh I see... So i did the following and tried to do it on my own but i did:
$ sudo gedit ~/.bashrc
Added the following config
export PATH=$PATH:/usr/local/go/bin export GOPATH=/var/Server/go; export PATH=$PATH:$GOPATH/bin;
$ source ~/.bashrc $ go get github.com/bwmarrin/discordgo
I then look at : /var/Server/go/bin
And its empty.
I do see /var/Server/go/src/github.com/FactoKit/FactoCord"
and continue to..
$ go build
and it returns:
main.go:17:2: local import "./commands" in non-local package main.go:18:2: local import "./commands/admin" in non-local package main.go:16:2: local import "./support" in non-local package.
When I look in /var/Server/go/src/github.com All I see is FactoKit and the other go gets are not there,
Did i do something incorrectly?
You're not really supposed to use local imports in go/ Sounds like a library issue
Could you explain what a Library issue is, so i can further understand?
Import paths should be in the form of github.com/yourname/project/package
Or be in a special vendor folder like
vendor/app/package
then you can import as app/package
in your project
Ahhh! I see them now, strange it took a while to show up.
So where do I navigate now to "go build"?
OH... i go into every folder...
Enter the FactoKit/FactoCord
directory and type go build
Ahh thankyou soooo much @Necroforger !!!
Everything built except the factocord which returned the same error:
main.go:17:2: local import "./commands" in non-local package main.go:18:2: local import "./commands/admin" in non-local package main.go:16:2: local import "./support" in non-local package.
Perhaps I should try an older pull of factocord..
Can I buy you a coffee?
You should just need to replace the lines at https://github.com/FactoKit/FactoCord/blob/master/main.go#L16 with
"github.com/FactoKit/FactoCord/support"
"github.com/FactoKit/FactoCord/commands"
"github.com/FactoKit/FactoCord/commands/admin"
To get it working
That did it!
Once again I thank-you!
Np If you need any more help you could check out the golang discord server https://discord.gg/5UsRjb
go get github.com/bwmarrin/discordgo
golang.org/x/crypto/poly1305
/usr/local/go/src/golang.org/x/crypto/poly1305/sum_amd64.s:8 6a: No such file or directory: textflag.h
github.com/gorilla/websocket
/usr/local/go/src/github.com/gorilla/websocket/compression.go:95: undefined: sync.Pool
How do I fix this? Did I do something wrong?