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

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!

Related

Is there a canonical way to add build scripts to a Go project? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 10 months ago.
Improve this question
Coming from the Node.js world, whenever you need a script (such as a build script there), a very common way of handling this is by adding it to the scripts block in the package.json file, so that you can the script by calling npm run <scriptname>. In other words, Node.js (respectively npm) has a built-in way to deal with (simple) scripts.
Does an equivalent to this exist in the Go world?
To put it differently: Suppose I have some commands such as doing a build, cleaning the build directory, creating a new version, and so on, is there a better way to do this than by adding a bunch of (platform-dependant) Bash script files?
In case there isn't – is there at least a common way of where to put these scripts? Or is this all left to the developer?
You can use Makefile
this one is what I use sometimes:
BINARY_NAME=main
build:
go mod tidy
go build -o ${BINARY_NAME} main.go
clean:
go clean
rm ${BINARY_NAME}

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

Getting error when trying to 'go get' the geos package [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 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.

I can't activate GO111MODULE [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 1 year ago.
Improve this question
I want to use go modules, after a lot of searching, I just saw some website that said, enable go111module with this command:
GO111MODULE=on
But it's not a path variable, it does not even exist on my pc, so it shows me
GO111MODULE is not recognized as an internal or external command, operable
program, or batch file.
Some people said it's enabled by default on GO v1.16 but it's not working for me,
How do I understand it's not working?
I use:
go mod init
and
go get <some_packages>
It adds the new package to my go.mod but my code can't recognize it and I have an "Unresolved dependency" error in my go.mod file.
I use Goland to solve my problem using their GUI's and it solved my problem but their settings just work on the current project and don't work globally.
What can I do? (I'm a Windows 10 user, Go version 1.16)
Answer (Update):
Set a path variable like this by yourself:
After that, run the command:
go env
You will have this line at first line:
set GO111MODULE=on
Yes its not a path variable.
It is a go environmental variable.
Yes is is available by default actually.
On your terminal, type
go env | grep "GO111MODULE"
That should show you what that variable is set to
You can try the same with other go env variables eg GOPROXY, GOPRIVATE etc just to satisfy yourself.
The output GO111MODULE="" means it is on (since Go 1.16)

How do I install lua dev libraries on MacOS? [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 2 years ago.
Improve this question
I need to install liblua5.3-dev for compiling a code project called Domoticz. I tried using 'brew' and 'luarocks' but it seems it doesn't provide me the development libraries but only a runtime/interpretor.
How do I install liblua5.3-dev on macOS (Catalina)?
You should just try the official way:
curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
tar zxf lua-5.3.5.tar.gz
cd lua-5.3.5
make macosx test

Resources