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

fix: Have make file fail with wrong go version #785

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

TerryHowe
Copy link
Member

Latest command oras repository ls requires go 1.20

Makefile Outdated Show resolved Hide resolved
@shizhMSFT
Copy link
Contributor

Since we have set the go module to have min go version of 1.20 as follows

oras/go.mod

Line 3 in 40d9a15

go 1.20

running make build or go build with go 1.19 will result in

note: module requires Go 1.20

which is expected.

@TerryHowe
Copy link
Member Author

The problem is note: module requires Go 1.20 is printed, but the build doesn't fail except for the problem area. Calling go mod tidy has the build fail if the version is too old.

@TerryHowe TerryHowe changed the title Have make file set required go version Have make file fail is the go version is not new enough Feb 3, 2023
@TerryHowe TerryHowe changed the title Have make file fail is the go version is not new enough docs: Have make file fail with wrong go version Feb 4, 2023
@TerryHowe TerryHowe changed the title docs: Have make file fail with wrong go version fix: Have make file fail with wrong go version Feb 4, 2023
@@ -31,8 +32,8 @@ LDFLAGS += -X $(PROJECT_PKG)/internal/version.GitCommit=${GIT_COMMIT}
LDFLAGS += -X $(PROJECT_PKG)/internal/version.GitTreeState=${GIT_DIRTY}

.PHONY: test
test: vendor check-encoding
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
test: tidy vendor check-encoding
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a problem. If someone opens a PR and messes the go.mod and go.sum files, calling go mod tidy in make test may not detect this kind of issue in the PR check.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not entirely sure what you mean by messes. Changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but it seems no harm for now.

Makefile Outdated
@@ -17,6 +17,7 @@ CLI_PKG = $(PROJECT_PKG)/cmd/oras
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
GO=go
Copy link
Contributor

Choose a reason for hiding this comment

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

I am assuming that you are managing Go installations according to https://go.dev/doc/manage-install.

I think it would be better to make the variable consistent:

Suggested change
GO=go
GO_EXE = go

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure thing.

I'm running my old go builds for various reasons.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: Terry Howe <tlhowe@amazon.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -31,8 +32,8 @@ LDFLAGS += -X $(PROJECT_PKG)/internal/version.GitCommit=${GIT_COMMIT}
LDFLAGS += -X $(PROJECT_PKG)/internal/version.GitTreeState=${GIT_DIRTY}

.PHONY: test
test: vendor check-encoding
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
test: tidy vendor check-encoding
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but it seems no harm for now.

@shizhMSFT shizhMSFT merged commit 8bda262 into oras-project:main Feb 7, 2023
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