Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up build stuff #77

Merged
merged 4 commits into from
Feb 4, 2024
Merged

Clean up build stuff #77

merged 4 commits into from
Feb 4, 2024

Conversation

cpuguy83
Copy link
Owner

@cpuguy83 cpuguy83 commented Aug 24, 2021

  1. Uses modern go in Dockerfile
  2. Fix make build pre-reqs
  3. Remove interim BUILDFLAGS handling
  4. Remove vendor dir (which was unused)
  5. passthrough buildkit platform vars
  6. parse buildkit vars in makefile

@cpuguy83 cpuguy83 requested a review from thaJeztah August 24, 2021 18:01
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved

bin:
@mkdir ./bin
bin/go-md2man: go.mod go.sum md2man/* *.go
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't comment on the lines above, but if we're cleaning up;

  • LINTER_BIN looks unused
  • perhaps change GO111MODULE default to auto

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this needs go modules. We need to make sure its own regardless of if we are in gopath or not.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... looks like it's ignoring the vendor directory.

rm -rf bin && docker run --rm -e GO111MODULE=auto -e CGO_ENABLED=0 -v $(pwd):/app -w /app golang:1.17 sh -c 'go build -o bin/go-md2man && bin/go-md2man --foobar'
go: downloading github.com/russross/blackfriday/v2 v2.1.0
flag provided but not defined: -foobar

rm -rf bin && docker run --rm -e GO111MODULE=on -e CGO_ENABLED=0 -v $(pwd):/app -w /app golang:1.17 sh -c 'go build -o bin/go-md2man && bin/go-md2man --foobar'
go: downloading github.com/russross/blackfriday/v2 v2.1.0
flag provided but not defined: -foobar

rm -rf bin && docker run --rm -e GO111MODULE=auto -e CGO_ENABLED=0 -v $(pwd):/go/src/github.com/cpuguy83/go-md2man -w /go/src/github.com/cpuguy83/go-md2man golang:1.17 bash -c 'go build -o bin/go-md2man && bin/go-md2man --foobar'
go: downloading github.com/russross/blackfriday/v2 v2.1.0
flag provided but not defined: -foobar

rm -rf bin && docker run --rm -e GO111MODULE=on -e CGO_ENABLED=0 -v $(pwd):/go/src/github.com/cpuguy83/go-md2man -w /go/src/github.com/cpuguy83/go-md2man golang:1.17 bash -c 'go build -o bin/go-md2man && bin/go-md2man --foobar'
go: downloading github.com/russross/blackfriday/v2 v2.1.0
flag provided but not defined: -foobar

So looks like all permutations ignore vendor and will download the module. Disabling networking shows that's indeed the case;

rm -rf bin && docker run --rm -e GO111MODULE=on --network=none -e CGO_ENABLED=0 -v $(pwd):/go/src/github.com/cpuguy83/go-md2man -w /go/src/github.com/cpuguy83/go-md2man golang:1.17 bash -c 'go build -o bin/go-md2man && bin/go-md2man --foobar'
go: github.com/russross/blackfriday/v2@v2.1.0: Get "https://proxy.golang.org/github.com/russross/blackfriday/v2/@v/v2.1.0.mod": dial tcp: lookup proxy.golang.org on 192.168.65.5:53: dial udp 192.168.65.5:53: connect: network is unreachable
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: github.com/russross/blackfriday/v2@v2.1.0: Get "https://proxy.golang.org/github.com/russross/blackfriday/v2/@v/v2.1.0.mod": dial tcp: lookup proxy.golang.org on 192.168.65.5:53: dial udp 192.168.65.5:53: connect: network is unreachable

The only option that works is to use -mod=vendor:

rm -rf bin && docker run --rm -e GO111MODULE=on --network=none -e CGO_ENABLED=0 -v $(pwd):/go/src/github.com/cpuguy83/go-md2man -w /go/src/github.com/cpuguy83/go-md2man golang:1.17 bash -c 'go build -mod=vendor -o bin/go-md2man && bin/go-md2man --foobar'

flag provided but not defined: -foobar
Usage of bin/go-md2man:

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right yes, vendor is leftover from go mod transition...

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed vendor dir.

@cpuguy83 cpuguy83 force-pushed the update_builds branch 2 times, most recently from 7b5639a to 68850f8 Compare August 24, 2021 20:55
@cpuguy83
Copy link
Owner Author

Added go1.11 to the test matrix.
Intentionally keeping older go because this is picked up in distro packages.

@cpuguy83 cpuguy83 force-pushed the update_builds branch 2 times, most recently from d81d36b to 090b299 Compare February 4, 2024 22:19
1. Uses modern go in Dockerfile
2. Fix `make build` pre-reqs
3. Remove interim BUILDFLAGS handling

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83 cpuguy83 merged commit b19b556 into master Feb 4, 2024
5 checks passed
@cpuguy83 cpuguy83 deleted the update_builds branch February 4, 2024 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants