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

Go 1.21.6, 1.21.7, 1.21.8, 1.22.0, 1.22.1 #123

Merged
merged 1 commit into from
May 10, 2024
Merged

Go 1.21.6, 1.21.7, 1.21.8, 1.22.0, 1.22.1 #123

merged 1 commit into from
May 10, 2024

Conversation

Fabio1988
Copy link
Contributor

@Fabio1988 Fabio1988 commented Mar 13, 2024

I tried to follow last update, hopefully everything covered

also removed go 1.20 version to not exceed 360 minutes building time of github actions

this needs crazy-max/goxx#70

@Fabio1988 Fabio1988 changed the title Update to support golang 1.22.1 Go 1.21.6, 1.21.7, 1.21.8, 1.22.0, 1.22.1 Mar 13, 2024
Copy link

@mochaaP mochaaP left a comment

Choose a reason for hiding this comment

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

LGTM

@mochaaP
Copy link

mochaaP commented Mar 14, 2024

cc @crazy-max

@mochaaP
Copy link

mochaaP commented Mar 14, 2024

I believe those are false positives? Rerun should pass the test

@crazy-max
Copy link
Owner

crazy-max commented Mar 14, 2024

I believe those are false positives? Rerun should pass the test

I don't think so: https://github.com/crazy-max/xgo/actions/runs/8278490599/job/22671620226?pr=123#step:5:200

0.180 INFO: Starting xgo/69d0307
0.180 DBG: config: &{Repository:. Package: Prefix:test Remote: Branch: Dependencies: Arguments: Targets:[*/*]}
0.180 DBG: flags: &{Verbose:false Steps:false Race:false Tags: LdFlags: Mode:default VCS:true TrimPath:false}
0.180 INFO: Don't use go modules (go.mod not found)
0.180 INFO: Cross compiling . package...
0.185 Building locally ....
0.352 Compiling for linux/amd64...
0.362 go: modules disabled by GO111MODULE=off; see 'go help modules'
0.363 ERROR: Failed to cross compile package: exit status 1.

Seems changes are needed since Go 1.22

@mochaaP
Copy link

mochaaP commented Mar 14, 2024

https://go.dev/doc/go1.22#go-command

tl;dr: go get is no longer supported outside of a module in the legacy GOPATH mode (that is, with GO111MODULE=off)

@Fabio1988
Copy link
Contributor Author

might be related to this commit? 607610c

@mochaaP
Copy link

mochaaP commented Mar 15, 2024

We might need to refactor the go get flow here.

@Fabio1988
Copy link
Contributor Author

Sorry I have no clue to achieve this, I thought it might be easy to update version to get my application workflow executable again. I updated already to 1.22. I guess I need to wait then :)

@mochaaP
Copy link

mochaaP commented Mar 15, 2024

🤔 I'll take a look later.

@mochaaP
Copy link

mochaaP commented Mar 18, 2024

Note: need to somehow add ghq to the base image. (either through Alpine's testing repo or go install)

diff --git a/rootfs/usr/local/bin/xgo-build b/rootfs/usr/local/bin/xgo-build
index 1780139..50de89f 100755
--- a/rootfs/usr/local/bin/xgo-build
+++ b/rootfs/usr/local/bin/xgo-build
@@ -99,7 +99,7 @@ else
 
   # Otherwise download the canonical import path (may fail, don't allow failures beyond)
   echo "Fetching main repository $1..."
-  GO111MODULE=off go get -v -d "$1"
+  GHQ_ROOT=$GOPATH_ROOT ghq get "$1"
   set -e
 
   cd "$GOPATH_ROOT/$1"
diff --git a/tests/c/go.mod b/tests/c/go.mod
new file mode 100644
index 0000000..8740bd4
--- /dev/null
+++ b/tests/c/go.mod
@@ -0,0 +1,3 @@
+module tests/c
+
+go 1.22.1
diff --git a/tests/cpp/go.mod b/tests/cpp/go.mod
new file mode 100644
index 0000000..ba3cd35
--- /dev/null
+++ b/tests/cpp/go.mod
@@ -0,0 +1,3 @@
+module tests/cpp
+
+go 1.22.1

@Fabio1988
Copy link
Contributor Author

Note: need to somehow add ghq to the base image. (either through Alpine's testing repo or go install)

so we need to adapt goxx image?

@Fabio1988
Copy link
Contributor Author

do you guys have a discord server for discussion or contact possibilities? also willed to donate to you :)
not sure about the effort to do, but I would like to use golang 1.22 in production 😄

@mochaaP
Copy link

mochaaP commented Apr 4, 2024

Will try to find a time to implement this. I think it's fine to go install it at a separate layer from the first build stage?

@Fabio1988
Copy link
Contributor Author

Will try to find a time to implement this. I think it's fine to go install it at a separate layer from the first build stage?

But do I think the right way that this needs fixing in goxx? Or what do you mean with go install? go install github.com/x-motemen/ghq@latest?

@Fabio1988 Fabio1988 requested a review from mochaaP April 24, 2024 10:04
Copy link

@mochaaP mochaaP left a comment

Choose a reason for hiding this comment

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

diff --git a/Dockerfile b/Dockerfile
index 0a72b9a..238e25e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,7 @@
 ARG GO_VERSION="1.22.1"
 ARG OSXCROSS_VERSION="11.3"
 ARG XX_VERSION="1.3.0"
-ARG ALPINE_VERSION="3.18"
+ARG ALPINE_VERSION="3.19"
 ARG PLATFORMS="linux/386 linux/amd64 linux/arm64 linux/arm/v5 linux/arm/v6 linux/arm/v7 linux/mips linux/mipsle linux/mips64 linux/mips64le linux/ppc64le linux/riscv64 linux/s390x windows/386 windows/amd64"
 
 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
@@ -13,6 +13,11 @@ ENV CGO_ENABLED=0
 RUN apk add --no-cache file git
 WORKDIR /src
 
+FROM base AS ghq
+ARG GHQ_VERSION="1.5.0"
+RUN --mount=type=cache,target=/go/pkg/mod \
+  go install github.com/x-motemen/ghq@v${GHQ_VERSION}
+
 FROM base AS version
 RUN --mount=target=. \
   echo $(git describe --match 'v[0-9]*' --dirty='.m' --always --tags) | tee /tmp/.version
@@ -100,6 +105,7 @@ EOT
 FROM crazymax/osxcross:${OSXCROSS_VERSION} AS osxcross
 FROM goxx-base
 COPY --from=build /usr/bin/xgo /usr/local/bin/xgo
+COPY --from=ghq /go/bin/ghq /usr/local/bin/ghq
 COPY --from=osxcross /osxcross /osxcross
 
 ENV XGO_IN_XGO="1"
diff --git a/rootfs/usr/local/bin/xgo-build b/rootfs/usr/local/bin/xgo-build
index 1780139..50de89f 100755
--- a/rootfs/usr/local/bin/xgo-build
+++ b/rootfs/usr/local/bin/xgo-build
@@ -99,7 +99,7 @@ else
 
   # Otherwise download the canonical import path (may fail, don't allow failures beyond)
   echo "Fetching main repository $1..."
-  GO111MODULE=off go get -v -d "$1"
+  GHQ_ROOT=$GOPATH_ROOT ghq get "$1"
   set -e
 
   cd "$GOPATH_ROOT/$1"
diff --git a/tests/c/go.mod b/tests/c/go.mod
new file mode 100644
index 0000000..8740bd4
--- /dev/null
+++ b/tests/c/go.mod
@@ -0,0 +1,3 @@
+module tests/c
+
+go 1.22.1
diff --git a/tests/cpp/go.mod b/tests/cpp/go.mod
new file mode 100644
index 0000000..ba3cd35
--- /dev/null
+++ b/tests/cpp/go.mod
@@ -0,0 +1,3 @@
+module tests/cpp
+
+go 1.22.1

@mochaaP
Copy link

mochaaP commented Apr 28, 2024

@Fabio1988
Copy link
Contributor Author

Test runs: https://github.com/mcha-forks/xgo/actions/runs/8865942312/job/24342766269

Thanks a lot.. applied diff and cleaned up commits :)

@mochaaP
Copy link

mochaaP commented Apr 28, 2024

cc'ing @crazy-max for this.

@mochaaP
Copy link

mochaaP commented Apr 28, 2024

@Fabio1988

also willed to donate to you :)

If you found my works useful, please consider donating to sekai instead: https://github.com/sponsors/nekohasekai. sing-box help me stay connected to the uncensored internet and made my contributions possible. :D

@Fabio1988
Copy link
Contributor Author

@Fabio1988

also willed to donate to you :)

If you found my works useful, please consider donating to sekai instead: https://github.com/sponsors/nekohasekai. sing-box help me stay connected to the uncensored internet and made my contributions possible. :D

Sure done, already sponsored crazy-max as well. Great work :)

@Fabio1988
Copy link
Contributor Author

any chance we can run the github actions on this change pls? should be safe regarding to https://github.com/mcha-forks/xgo/actions/runs/8865942312/job/24342766269 :) @crazy-max

tests/c/go.mod Outdated Show resolved Hide resolved
tests/cpp/go.mod Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@Fabio1988
Copy link
Contributor Author

Thanks for the review, will Squash commits later

Dockerfile Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
@Fabio1988
Copy link
Contributor Author

thanks so the last piece was that the test files used go 1.22 instead of 1.21? does this even matter for the tests? :)

@crazy-max crazy-max merged commit 62c1687 into crazy-max:master May 10, 2024
21 checks passed
@Fabio1988 Fabio1988 deleted the patch-1 branch May 10, 2024 21:11
@crazy-max
Copy link
Owner

thanks so the last piece was that the test files used go 1.22 instead of 1.21? does this even matter for the tests? :)

Yes it matters as 1.22 toolchain is not available with Go 1.21.

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.

3 participants