-1

Docker file

FROM golang:1.13 AS builder
RUN go get github.com/pin/tftp

when building the image getting following error is there a workaround for this

~$ docker-compose build
Building xxxx_yyyy
Step 1/48 : FROM golang:1.13 AS builder
 ---> d6f3656320fe
Step 2/48 : RUN go get github.com/pin/tftp
 ---> Running in 63eb460130f5
# golang.org/x/sys/unix
src/golang.org/x/sys/unix/mremap.go:42:10: undefined: unsafe.Slice
src/golang.org/x/sys/unix/syscall.go:83:16: undefined: unsafe.Slice
src/golang.org/x/sys/unix/syscall_linux.go:1018:20: undefined: unsafe.Slice
src/golang.org/x/sys/unix/syscall_linux.go:2300:9: undefined: unsafe.Slice
src/golang.org/x/sys/unix/syscall_unix.go:118:7: undefined: unsafe.Slice
src/go
lang.org/x/sys/unix/sysvshm_unix.go:33:7: undefined: unsafe.Slice
ERROR: Service 'xxxx_yyyy' failed to build: The command '/bin/sh -c go get 
~$

Wanted to try this workaround but dontknow how to do in Docker

https://stackoverflow.com/questions/74049351/gcloud-functions-deploy-go-runtime-error-undefined-unsafe-slice-error-id-2f5

I tried to use a go 1.18 version that had another problem Docker file

FROM golang:1.18 AS builder
RUN go install github.com/pin/tftp@latest
Building xxxx_yyyy
Step 1/49 : FROM golang:1.18 AS builder
 ---> c37a56a6d654
Step 2/49 : RUN go install github.com/pin/tftp@latest
 ---> Running in 3c1d893b0384
go: downloading github.com/pin/tftp v2.1.0+incompatible
package github.com/pin/tftp is not a main package
ERROR: Service 'xxxx_yyyy' failed to build: The command '/bin/sh -c go install github.com/pin/tftp@latest' returned a non-zero code: 1
  • The error `package github.com/pin/tftp is not a main package` means that you cannot `go install` that program. You can download it, and you can use it in your own program by importing it, but you _cannot install_ it because it is not a `main` package. Only `main` packages can be installed. NOTE that in the old dockerfile you're using `go get`, in the new one you are using `go install`. – mkopriva Aug 30 '23 at 15:40
  • In addition to what mkopriva explained: Go 1.13 is years outdated. – Volker Aug 30 '23 at 18:06

0 Answers0