cfssl icon indicating copy to clipboard operation
cfssl copied to clipboard

undefined: strings.CutPrefix

Open Hanoboo opened this issue 1 year ago • 3 comments

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

Hanoboo avatar Mar 27 '24 09:03 Hanoboo

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

LufDevOps avatar May 07 '24 01:05 LufDevOps

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 avatar May 07 '24 03:05 LufDevOps

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

LufDevOps avatar May 07 '24 03:05 LufDevOps