Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 'go get' is no longer supported outside a module. #5094

Open
zuygui opened this issue May 12, 2024 · 3 comments
Open

Error: 'go get' is no longer supported outside a module. #5094

zuygui opened this issue May 12, 2024 · 3 comments
Labels

Comments

@zuygui
Copy link

zuygui commented May 12, 2024

Xmake Version

2.9.1

Operating System Version and Architecture

Arch Linux

Describe Bug

With the help of @Bricklou, I would create a project an golang project using XMake. Everything is fine but when I would add Zap to the project, I got this error:

󰣇 zuygui on tetaclax at …/operator via  main ( 󰛿 modified=1 󰋗 untracked=4 ) xmake
checking for platform ... linux
checking for architecture ... x86_64
note: install or modify (m) these packages (pass -y to skip confirm)?
in go:
  -> go::go.uber.org/zap latest 
please input: y (y/n/m)
y
  => install go::go.uber.org/zap latest .. failed

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'.
if you want to get more verbose errors, please see:
  -> /home/zuygui/Documents/dev/kubercraft/operator/build/.packages/g/go_go.uber.org/zap/latest/cache/installdir.failed/logs/install.txt
error: install failed!

Expected Behavior

XMake should have downloaded and installed the library without any problems.

Project Configuration

add_rules("mode.debug", "mode.release")

add_requires("go::go.uber.org/zap")

target("operator")
    set_kind("binary")
    add_files("src/*.go")

    add_packages("zap")

Additional Information and Error Logs

The error say a go.mod is missing during the lib installation, so I think you should put the go.mod generation before the libraries installation.

@zuygui zuygui added the bug label May 12, 2024
@waruqi
Copy link
Member

waruqi commented May 13, 2024

Since the new version of go made a lot of changes, some of the original support is broken, but I don't have much time to support it at the moment.

@zuygui
Copy link
Author

zuygui commented May 27, 2024

👍

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants