Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

648
Visualizações
Go build: build output "api" already exists and is a directory

I am trying to use CompileDaemon to hot reload a go project using Docker.

My folder structure looks like the below

my-api
 - server
   - main.go
 - Dockerfile
 - docker-compose.yml
 - Makefile

This is the error I am getting:

go build github.com/firstApi/test-platform/lib/my-api/server: build output "server" already exists and is a directory

This is what my dockerfile looks like

FROM golang:1.12-stretch

ENV GO111MODULE=on
WORKDIR /go/src

COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .

RUN ["go", "get", "github.com/githubnemo/CompileDaemon"]

RUN go test ./... \
&& CGO_ENABLED=0 go build -v -a -installsuffix cgo -o /main server/main.go

ENTRYPOINT CompileDaemon -log-prefix=false -build="go build ./server" -command="./main"

any ideas what I am doing wrong and what I need to change in order to fix this issue?

UPDATE*****

I tried the solution as suggested by the only answer but I now get the following error:

Could not start command:%!(EXTRA *errors.errorString=can't start command: fork/exec ./server: permission denied)
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Your default go build is attempting to output the same name as the directory. You could change your build and ENTRYPOINT line to refer to "go build -o apiserver".

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda