rakyll / statik

Embed files into a Go executable
Apache License 2.0
3.75k stars 225 forks source link

When compling on the CI i get an statik error #121

Open EugenMayer opened 3 years ago

EugenMayer commented 3 years ago

I can compile the app (as usual) locally without issues. After switching to to an azure pipeline, i compile the up under golang:1.15-buster

I do install statik using

cd /tmp
go get github.com/rakyll/statik

Then i call statik as expected

cd /src
${GOPATH}/bin/statik -f -src=./public

And this properly generates the build under ../statik/statik.go in my src folder

Without any issues. But when i call go build (from the same cwd)

cd /src
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags "-X github.com/<redacted>/build.Version=${{ variables.version }}" -o dist/<redacted> <redacted>_static.go

It errors with

statik/statik.go:6:2: cannot find package "." in:
    /__w/1/s/vendor/github.com/rakyll/statik/fs

I tried quiet some pieces but yet nothing worked.

My <redacted>_statik.go looks like

import (
    "flag"
    "github.com/<redacted>/bootstrap"
    "net/http"
    // will be generated by statik
    _ "github.com/<redacted>/statik"
    "github.com/rakyll/statik/fs"
    "log"
)

func main() {...}

Helpful for any clues!