Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

658
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda