Giter Site home page Giter Site logo

Comments (5)

RobertBerger avatar RobertBerger commented on August 16, 2024

I did some more research on this issue and it looks like your Dockerfile is problematic.
The way it's written is cool, but unfortunately go-licenses seems to require a full go runtime.

This is my hacked up version of Dockerfile

FROM golang:1.16

WORKDIR /go-licenses

ARG GOFLAGS=""
ENV GOFLAGS=$GOFLAGS
ENV GO111MODULE=on

# Download dependencies first - this should be cacheable.
COPY go.mod go.sum ./
RUN go mod download

# Now add the local repo, which typically isn't cacheable.
COPY . .

# Check that all of the Go code builds
RUN go build ./...

# Run the tests
RUN go test -v ./...

# Install the binary into /go/bin
RUN go install .

# Save licenses, etc.
RUN go run . save . --save_path /THIRD_PARTY_NOTICES

Now I can run it like this:

docker run --entrypoint=/bin/bash -ti reslocal/go-licenses-container

In the container

go get -d github.com/influxdata/telegraf
go: downloading github.com/influxdata/telegraf v1.18.0
go get: upgraded github.com/google/go-cmp v0.3.1 => v0.5.4
go get: added github.com/influxdata/telegraf v1.18.0
go get: upgraded golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f => v0.0.0-20200820211705-5c72a883971a
go get: upgraded golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914 => v0.0.0-20201209123823-ac852fbbde11
go get: upgraded golang.org/x/sys v0.0.0-20191119060738-e882bf8e40c2 => v0.0.0-20201119102817-f84b799fce68
go get: upgraded golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98 => v0.0.0-20201022035929-9cf592e881e9

cd /go/pkg/mod/github.com/influxdata/[email protected]/cmd/telegraf
go-licenses csv . > licenses.txt 2>&1

The result is this:
https://pastebin.com/JchrPZ99

... which does not seem to be very useful.

First Error: https://github.com/couchbase/goutils does have a LICENSE.md file

from go-licenses.

Bobgy avatar Bobgy commented on August 16, 2024

The current version of go-licenses uses a google/licenseclassifier version that embeds the data into the binary, so this issue will no longer show up.

from go-licenses.

andoks avatar andoks commented on August 16, 2024

I stumbled over this (or a similar related issue) after having upgraded various dependencies. I got the error "main.go:77] cannot register licenses from archive: open licenses.db: file does not exist", and had to downgrade the licenseclassfier library to get it working again (go: downgraded github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab => v0.0.0-20210722185704-3043a050f148).

Worthy of note is that executing the tool with explicit version specified (go run github.com/google/[email protected] save --ignore=my-package --force --save_path licenses ./...) worked fine, while doing go get -u github.com/google/[email protected] then go run without version (go run github.com/google/go-licenses save --ignore=my-package --force --save_path licenses ./...) exhibited the above issue.

from go-licenses.

Bobgy avatar Bobgy commented on August 16, 2024

I stumbled over this (or a similar related issue) after having upgraded various dependencies. I got the error "main.go:77] cannot register licenses from archive: open licenses.db: file does not exist", and had to downgrade the licenseclassfier library to get it working again (go: downgraded github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab => v0.0.0-20210722185704-3043a050f148).

Worthy of note is that executing the tool with explicit version specified (go run github.com/google/[email protected] save --ignore=my-package --force --save_path licenses ./...) worked fine, while doing go get -u github.com/google/[email protected] then go run without version (go run github.com/google/go-licenses save --ignore=insight-api --force --save_path licenses ./...) exhibited the above issue.

What's your go version? go get is now deprecated for installing binaries. Use go install instead. You might be accidentally using an old binary.

from go-licenses.

andoks avatar andoks commented on August 16, 2024

Go 1.20.7. But i never installed any binary using go get in this instance, I upgraded my dependencies, and since we use the tools.go method to pin versions of our tooling, then run the tools using go run. I upgraded the "licenseclassifier" and "copy" libraries to versions that does not work with go-licenses using go get -u.

from go-licenses.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.