Skip to content

🌱 fix catalogd version variable paths in Makefile #1705

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion catalogd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ VERSION := $(shell git describe --tags --always --dirty)
endif
export VERSION

export VERSION_PKG := $(shell go list -m)/internal/version
export VERSION_PKG := $(shell go list -mod=mod ./internal/version)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the fix, but I am not sure why we need to use -mod.

Copy link
Member

@LalatenduMohanty LalatenduMohanty Feb 5, 2025

Choose a reason for hiding this comment

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

I tested this in the Makefile by printing the VERSION_PKG. Without this fix it resolves to github.com/operator-framework/operator-controller/internal/version and with the fix it resolves to github.com/operator-framework/operator-controller/catalogd/internal/version

.PHONY: print-version
+print-version:
+       echo "$(VERSION_PKG)"
$ git diff
diff --git a/catalogd/Makefile b/catalogd/Makefile
index ce56ed5..447a6a0 100644
--- a/catalogd/Makefile
+++ b/catalogd/Makefile
@@ -122,6 +122,9 @@ endif
 export VERSION
 
 export VERSION_PKG     := $(shell go list -m)/internal/version
+.PHONY: print-version
+print-version:
+       echo "$(VERSION_PKG)"
 
 export GIT_COMMIT      := $(shell git rev-parse HEAD)
 export GIT_VERSION     := $(shell git describe --tags --always --dirty)
lmohanty@LenovoP16v:~/code/github.com/OLM-Upstream/operator-controller/catalogd$ make print-version 
echo "github.com/operator-framework/operator-controller/internal/version"
github.com/operator-framework/operator-controller/internal/version

$ git diff
diff --git a/catalogd/Makefile b/catalogd/Makefile
index ce56ed5..c2cc8c6 100644
--- a/catalogd/Makefile
+++ b/catalogd/Makefile
@@ -121,7 +121,10 @@ VERSION := $(shell git describe --tags --always --dirty)
 endif
 export VERSION
 
-export VERSION_PKG     := $(shell go list -m)/internal/version
+export VERSION_PKG     := $(shell go list -mod=mod ./internal/version)
+.PHONY: print-version
+print-version:
+       echo "$(VERSION_PKG)"
 
 export GIT_COMMIT      := $(shell git rev-parse HEAD)
 export GIT_VERSION     := $(shell git describe --tags --always --dirty)

$ make print-version 
echo "github.com/operator-framework/operator-controller/catalogd/internal/version"
github.com/operator-framework/operator-controller/catalogd/internal/version

Copy link
Member

@LalatenduMohanty LalatenduMohanty Feb 5, 2025

Choose a reason for hiding this comment

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

-mod=mod Forces the command to use module mode to resolve dependencies instead of old GOPATH mode.


export GIT_COMMIT := $(shell git rev-parse HEAD)
export GIT_VERSION := $(shell git describe --tags --always --dirty)
Expand Down
Loading