You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import"myapp/src/foo"funcmain() {
foo.bar()
}
go.mod:
module myapp
go 1.13
require git.my.company.com/golang/anotherdep v1.0.3
On my workstation, this project build correctly with go build main.go
Now, I want to build this project from a Dockerfile in order to integrate it in a deployment pipeline.
The Dockerfile is as follow:
FROM golang:1.13.8-buster as build
ENV GO111MODULE="on"ENV GOPROXY="https://repo.my.company.com/artifactory/api/go/proxy-go"ENV GOPRIVATE="git.my.company.com"RUN mkdir myapp
COPY ./* ./myapp/
WORKDIR ./myapp/
RUN go env
RUN go build -o app -v -x main.go
When I build this project from the Dockerfile, it fails:
$ docker build --no-cache -t myapp .
...
build command-line-arguments: cannot load myapp/src/foo: malformed module path "myapp/src/foo": missing dot in first path element
The text was updated successfully, but these errors were encountered:
lucas-dehandschutter
changed the title
missing dot in first path element when building from official golang image
missing dot in first path element when building from official golang Docker image
Feb 24, 2020
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I have a Go module project organized as follow:
The main.go file looks like this:
go.mod:
On my workstation, this project build correctly with go build main.go
Now, I want to build this project from a Dockerfile in order to integrate it in a deployment pipeline.
The Dockerfile is as follow:
When I build this project from the Dockerfile, it fails:
go env
Output from my workstationgo env
Output from the build containerThe text was updated successfully, but these errors were encountered: