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

Makefile does not pick up go alias: consider introducing a variable #697

Closed
rajp152k opened this issue Jan 2, 2025 · 3 comments · Fixed by #702
Closed

Makefile does not pick up go alias: consider introducing a variable #697

rajp152k opened this issue Jan 2, 2025 · 3 comments · Fixed by #702
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@rajp152k
Copy link
Contributor

rajp152k commented Jan 2, 2025

What happened?

currently, rather than using a shell variable that can be sourced by aliases, the Makefile uses hard coded "go"..

This makes it difficult to use for developers working with multiple versions of golang..

although go is supposed to be backward compatible, I run into test fails when using go1.23 (the code contribution docs say that go1.19+ should be fine)..

when using go1.22 (as in go.mod), the tests pass but I had to explicitly hard code the 1.22 in the makefile as it wasn't picking up my aliases

this is what happens with the default makefile test (line 42)

-*- mode: compilation; default-directory: "~/source/vcops/os-contribs/KusionStack/karpor/" -*-
Compilation started at Thu Jan  2 11:45:45

make test -j 16
ok  	github.com/KusionStack/karpor/pkg/core/entity	(cached)
ok  	github.com/KusionStack/karpor/pkg/core/health	(cached)
ok  	github.com/KusionStack/karpor/pkg/core/manager/ai	(cached)
# github.com/KusionStack/karpor/pkg/util/certgenerator.test
link: github.com/bytedance/mockey/internal/monkey/common: invalid reference to runtime.sysAllocOS
# github.com/KusionStack/karpor/pkg/core/manager/cluster.test
link: github.com/bytedance/mockey/internal/monkey/common: invalid reference to runtime.sysAllocOS
FAIL	github.com/KusionStack/karpor/pkg/core/manager/cluster [build failed]
# github.com/KusionStack/karpor/pkg/core/manager/insight.test
link: github.com/bytedance/mockey/internal/monkey/common: invalid reference to runtime.sysAllocOS
FAIL	github.com/KusionStack/karpor/pkg/core/manager/insight [build failed]
?   	github.com/KusionStack/karpor/pkg/core/manager/search	[no test files]
ok  	github.com/KusionStack/karpor/pkg/core/manager/resourcegroup	(cached)
# github.com/KusionStack/karpor/pkg/core/route.test
link: github.com/bytedance/mockey/internal/monkey/common: invalid reference to runtime.sysAllocOS
FAIL	github.com/KusionStack/karpor/pkg/core/route [build failed]
?   	github.com/KusionStack/karpor/pkg/infra/ai	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/multicluster	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/scanner	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/scanner/kubeaudit	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/search/storage	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/topology	[no test files]
?   	github.com/KusionStack/karpor/pkg/kubernetes/scheme	[no test files]
# github.com/KusionStack/karpor/pkg/syncer.test
link: github.com/bytedance/mockey/internal/monkey/common: invalid reference to runtime.sysAllocOS
FAIL	github.com/KusionStack/karpor/pkg/syncer [build failed]
?   	github.com/KusionStack/karpor/pkg/syncer/transform	[no test files]
ok  	github.com/KusionStack/karpor/pkg/syncer/cache	(cached)
ok  	github.com/KusionStack/karpor/pkg/syncer/jsonextracter	(cached)
# github.com/KusionStack/karpor/pkg/syncer/utils.test
link: github.com/bytedance/mockey/internal/monkey/common: invalid reference to runtime.sysAllocOS
FAIL	github.com/KusionStack/karpor/pkg/syncer/utils [build failed]
FAIL	github.com/KusionStack/karpor/pkg/util/certgenerator [build failed]
ok  	github.com/KusionStack/karpor/pkg/util/cache	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/clusterinstall	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/ctxutil	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/jsonpath	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/proxy	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/safeutil	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/sql2es	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/topology	(cached)
FAIL
make: *** [Makefile:42: test] Error 1

Compilation exited abnormally with code 2 at Thu Jan  2 11:45:47, duration 2.14 s

What did you expect to happen?

the tests should have passed..

hardcoded version of makefile:

.PHONY: test
test:  ## Run the tests
	@PKG_LIST=$${TARGET_PKG:-$(GOSOURCE_PATHS)}; \
	go1.22.10 test -gcflags=all=-l -timeout=10m `go1.22.10 list -e $${PKG_LIST} | grep -vE "cmd|internal|internalimport|generated|handler|middleware|registry|openapi|apis|version|gitutil|server|elasticsearch"` ${TEST_FLAGS}

output:

-*- mode: compilation; default-directory: "~/source/vcops/os-contribs/KusionStack/karpor/" -*-
Compilation started at Thu Jan  2 11:42:32

make test -j 16
ok  	github.com/KusionStack/karpor/pkg/core/entity	(cached)
ok  	github.com/KusionStack/karpor/pkg/core/health	(cached)
ok  	github.com/KusionStack/karpor/pkg/core/manager/ai	(cached)
ok  	github.com/KusionStack/karpor/pkg/core/manager/cluster	(cached)
ok  	github.com/KusionStack/karpor/pkg/core/manager/insight	(cached)
ok  	github.com/KusionStack/karpor/pkg/core/manager/resourcegroup	(cached)
?   	github.com/KusionStack/karpor/pkg/core/manager/search	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/ai	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/multicluster	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/scanner/kubeaudit	[no test files]
ok  	github.com/KusionStack/karpor/pkg/core/route	(cached)
?   	github.com/KusionStack/karpor/pkg/infra/search/storage	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/scanner	[no test files]
?   	github.com/KusionStack/karpor/pkg/infra/topology	[no test files]
?   	github.com/KusionStack/karpor/pkg/kubernetes/scheme	[no test files]
ok  	github.com/KusionStack/karpor/pkg/syncer	(cached)
?   	github.com/KusionStack/karpor/pkg/syncer/transform	[no test files]
ok  	github.com/KusionStack/karpor/pkg/syncer/cache	(cached)
ok  	github.com/KusionStack/karpor/pkg/syncer/jsonextracter	(cached)
ok  	github.com/KusionStack/karpor/pkg/syncer/utils	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/cache	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/certgenerator	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/clusterinstall	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/ctxutil	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/jsonpath	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/proxy	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/safeutil	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/sql2es	(cached)
ok  	github.com/KusionStack/karpor/pkg/util/topology	(cached)

Compilation finished at Thu Jan  2 11:42:33, duration 1.59 s

How can we reproduce it (as minimally and precisely as possible)?

  • install 1.23.1 go
~/s/v/o/KusionStack/karpor [main] λ go version
go version go1.23.1 linux/amd64

  • run make test

Anything else we need to know?

https://superuser.com/questions/936342/how-to-get-make-to-recognize-alias-command

Karpor version

v0.1.0

OS version

cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20240927"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20240927"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
# CPE 2.3 format, boo#1217921
CPE_NAME="cpe:2.3:o:opensuse:tumbleweed:20240927:*:*:*:*:*:*:*"
#CPE 2.2 format
#CPE_NAME="cpe:/o:opensuse:tumbleweed:20240927"
BUG_REPORT_URL="https://bugzilla.opensuse.org"
SUPPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"

Install tools

@elliotxx
Copy link
Collaborator

elliotxx commented Jan 2, 2025

@rajp152k Sorry, the go version that Karpor relies on has been upgraded from 1.19 to 1.22 after #646 . I will add this explanation in the documentation, which is my oversight.

The issue with Makefile is that I am using it locally g I managed the Go version, so I didn't encounter the problem you mentioned. But I will optimize the Makefile to make it compatible with methods that use go aliases. Please review it later.

Also, let me take another look at the errors encountered when using 1.23 ...

@elliotxx elliotxx self-assigned this Jan 2, 2025
@elliotxx elliotxx added documentation Improvements or additions to documentation enhancement New feature or request labels Jan 2, 2025
@rajp152k
Copy link
Contributor Author

rajp152k commented Jan 2, 2025

thanks

for now, one can work with symlinked go (ln -s) to go1.22 and the make file will work as is

@elliotxx
Copy link
Collaborator

elliotxx commented Jan 3, 2025

Fix some problems you mentioned above: #702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants