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

undefined: strings.CutPrefix #1370

Open
Hanoboo opened this issue Mar 27, 2024 · 3 comments
Open

undefined: strings.CutPrefix #1370

Hanoboo opened this issue Mar 27, 2024 · 3 comments

Comments

@Hanoboo
Copy link

Hanoboo commented Mar 27, 2024

When I executed the install command an error was returned, but my go version was greater than the required 1.18.

  • Installation command

    go install github.com/cloudflare/cfssl/cmd/...@latest

  • Error message

  # github.com/prometheus/common/model
  go/pkg/mod/github.com/prometheus/[email protected]/model/metric.go:363:33: undefined: strings.CutPrefix
  note: module requires Go 1.20
@LufDevOps
Copy link

anyone has answer for this issue? i did reinstall go 1.20 version

@LufDevOps
Copy link

The problem when i try to build an image of my app to extract some metric and this happend in build binary step
image

So i think in your Dockerfile you need to change to golang image version:
37cbf756c82f6971303e
and you may need to change your system go version to >= 1.20
image
by doing:
Go to this link: https://go.dev/dl/
scroll down you will see:
image
click on that, scroll down to 1.20
image

  • cd Downloads
  • sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
  • vim .zshrc
    -and add this line to .zshrc: - export PATH=$PATH:/usr/local/go/bin
    image
  • source .zshrc
  • go version
    ! After that you may need to restart vscode or computer so the vs can re detect the new go version
    image

and then i can build the image
image

@LufDevOps
Copy link

you may dont need to change the go system version, only need to change 1 line in Dockerfile to 1.20

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

No branches or pull requests

2 participants