Getting error when trying to 'go get' the geos package [closed] - go

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
i have tried to run a new project of golang i've installed everything but I faced the following problem
$ go get github.com/paulsmith/gogeos/geos
#### #github.com/paulsmith/gogeos/geos
In file included from ..\..\go\pkg\mod\github.com\paulsmith\gogeos#v0.1.2\geos\coordseq.go:4:
./geos.h:1:10: fatal error: geos_c.h: No such file or directory
1 | #include <geos_c.h>
| ^~~~~~~~~~
compilation terminated.

Looking at the installation instructions on the project's page, it seems like you have to install GEOS first; see this part: https://github.com/paulsmith/gogeos#requirements
It can be as easy as $ apt-get install libgeos-dev on Ubuntu, but the link above has instructions for a from-source installation as well.
What happens in your case is that the Go package likely uses cgo to load C code from GEOS, and it fails immediately because GEOS is not installed, and cgo cannot find the headers files.

Related

can't install a go module, using get -u and install [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed last month.
Improve this question
I want to install go-fastping, but when I try using
go get -u github.com/tatsushid/go-fastping, this error gets displayed:
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'.
so I changed to install:
go install github.com/tatsushid/go-fastping
Try 'go install github.com/tatsushid/go-fastping#latest' to install the latest version
and after I did changed to: go install github.com/tatsushid/go-fastping#latest
it worked but when I try to add it in the code it says that the module is not installed.
Your project most likely doesn't have a go.mod file.
Inside the root of your project run go mod init <module-name> to create a module and then you can run go get -u github.com/tatsushid/go-fastping to add this dependency to your project.

ipfs-update isn't showing the expected version list [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I ran
go get -u github.com/ipfs/ipfs-update
and got in the end of what it looks like an installation going on the following
go get: installing executables with 'go get' in module mode is deprecated.
Use 'go install pkg#version' instead.
For more information, see https://golang.org/doc/go-get-install-deprecation or run 'go help get' or 'go help install'.
github.com/ipfs/ipfs-update
go/pkg/mod/github.com/ipfs/ipfs-update#v1.7.1/main.go:318:21: cannot use lib.NewIpfsFetcher(distPath, 0) (type *lib.IpfsFetcher) as type migrations.Fetcher in argument to migrations.NewMultiFetcher:
*lib.IpfsFetcher does not implement migrations.Fetcher (missing Close method)
Then, used
ipfs-update versions
but didn't see the latest version.
To get that working I've used instead
go install github.com/ipfs/ipfs-update#latest
Then once running
ipfs-update versions
I got
Then could simply run
ipfs-update install v0.11.0

Go (lang) can not find module [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I did go get github.com/nanobox-io/golang-scribble, but when i try to run the main.go i get the error
[jerome#thearch beer-server]$ go run main.go
../../pkg/storage/json/repository.go:14:2: cannot find package "github.com/nanobox.io/golang-scribble" in any of:
/usr/lib/go/src/github.com/nanobox.io/golang-scribble (from $GOROOT)
/home/jerome/Documents/code/go/domainhex/src/github.com/nanobox.io/golang-scribble (from $GOPATH)
so i searched it:
[jerome#thearch nanobox-io]$ find /home/jerome/Documents/code/go/domainhex/src/github.com/nanobox.io -name golang-scribble
find: ‘/home/jerome/Documents/code/go/domainhex/src/github.com/nanobox.io’: No such file or directory
There is the thing completly weird, i cd follow the link and the package golang-scribble is present at the right place. So i pwd to get the path and use it to run the same cmd as previously
[jerome#thearch nanobox-io]$ pwd
/home/jerome/Documents/code/go/domainhex/src/github.com/nanobox-io
[jerome#thearch nanobox-io]$ ls
golang-scribble
[jerome#thearch nanobox-io]$ find /home/jerome/Documents/code/go/domainhex/src/github.com/nanobox-io -name golang-scribble
/home/jerome/Documents/code/go/domainhex/src/github.com/nanobox-io/golang-scribble
I don t know what's wrong ?
If i add some other package like github.com/google/uuid or julienschmidt/httprouter, it works perfectly.
extra-info
go version go1.16.2 linux/amd64
GO111MODULE="auto"
GOPATH="/home/jerome/Documents/code/go/domainhex"
Operating System: Arch Linux
Kernel: Linux 5.11.6-arch1-1
Architecture: x86-64
You are doing go get on github.com/nanobox-io/golang-scribble but you're importing github.com/nanobox.io/golang-scribble, the difference being nanobox-io vs nanobox.io. Try changing your import statement to github.com/nanobox-io/golang-scribble.

Install packages locally in golang module feature [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
When I install a package using go get, in the golang module mode, these are installed in the go root folder.
I would like to be able to install the modules in the same way that npm or yarn does for node.js, global or local.
what would be the right way to achieve this behavior.
Thanks.
As others have mentioned, you can create your module files like this:
go mod init [import path]
After that you can run this command any time to move all dependencies into the vendor directory:
go mod vendor
This is very similar to the behaviour of the node_modules directory.
To build using the dependencies in this directory, you can add -mod vendor to your build command:
go build -mod vendor
This way you can copy your project to any machine without go-getting anything on that other machine.
According to the docs, the -mod=vendor flag is set automatically if the Go version in the go.mod file is 1.14 or higher and a vendor directory exists.
To clean unused dependencies from the vendor directory, you can run
go mod tidy
There is little bit different approach. Go lock versions based on github (gitlab, etc) current commit. When you want to use specific versions of packages and not master all the time you want to use go modules (this is official way to do it, but there are some other tools). You init module in you project
go mod init [possible custom package name]
And everytime you call "go get somepackage" it writes versions it uses to a file called go.mod.
You can read more here

“module 'socket.http' not found:” --Lua on iMac [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
When I run my code in terminal, I get this error/message:
module 'socket.http' not found:
no field package.preload['socket.http']
no file '/usr/local/share/lua/5.2/socket/http.lua'
no file '/usr/local/share/lua/5.2/socket/http/init.lua'
no file '/usr/local/lib/lua/5.2/socket/http.lua'
no file '/usr/local/lib/lua/5.2/socket/http/init.lua'
no file './socket/http.lua'
no file '/usr/local/lib/lua/5.2/socket/http.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './socket/http.so'
no file '/usr/local/lib/lua/5.2/socket.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './socket.so'
Some sources led me to look into LuaSocket, but I still have no idea on what to do or how I would install that.
There are several places where a guide to install LuaSocket is available. Some of them are listed as follows:
http://w3.impa.br/~diego/software/luasocket/installation.html
https://github.com/diegonehab/luasocket/tree/cvs-diego
http://luarocks.org/
My preferred method would be to install LuaRocks and then use the following command in terminal:
luarocks install luasocket
A few more points. While configuring luarocks you may need to point to lua installation directory for example:
./configure --with-lua=/opt/lua53/
There are similar options:
--with-lua-bin
--with-lua-include
You can use any of these but make sure the desired directory structure is available in the directory you have mentioned!

Resources