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

Update to Go 1.17 #57

Merged
merged 2 commits into from
Nov 13, 2021
Merged

Update to Go 1.17 #57

merged 2 commits into from
Nov 13, 2021

Conversation

andrerfcsantos
Copy link
Member

@andrerfcsantos andrerfcsantos commented Nov 9, 2021

Part of exercism/go#1881

On this one I noticed we are using buster instead of alpine - is there any historical reason for this?

Related PR's:

@andrerfcsantos andrerfcsantos requested a review from a team as a code owner November 9, 2021 00:12
@coveralls
Copy link

coveralls commented Nov 9, 2021

Pull Request Test Coverage Report for Build 1441588800

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 79.31%

Totals Coverage Status
Change from base Build 1394241755: 0.0%
Covered Lines: 23
Relevant Lines: 29

💛 - Coveralls

@junedev
Copy link
Member

junedev commented Nov 10, 2021

To answer your question re buster: This is the issue why people usually do this golang/go#14481. Do you know for a fact this is reolved in all the newer golang alpine versions? The issue is closed but the comments seem ambiguous. If its really properly resolved by now, you can switch to alpine.

Dockerfile Outdated Show resolved Hide resolved
@junedev junedev added x:size/small Small amount of work and removed x:size/tiny Tiny amount of work labels Nov 10, 2021
@ErikSchierboom
Copy link
Member

@andrerfcsantos Just to be safe: do old Go solutions still work with the test runner?

@andrerfcsantos
Copy link
Member Author

@andrerfcsantos Just to be safe: do old Go solutions still work with the test runner?

Yes, they should as Go is backwards compatible (Go 1 compatibility promise)

I was trying to test the container locally, but I'm getting this error:

$ docker build -t exercism/go-test-runner .
[+] Building 6.6s (10/10) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 38B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 34B                                                                                   0.0s
 => [internal] load metadata for docker.io/library/golang:1.17-alpine3.14                                          5.2s
 => [internal] load build context                                                                                  1.2s
 => => transferring context: 14.35kB                                                                               1.2s
 => [1/5] FROM docker.io/library/golang:1.17-alpine3.14@sha256:102bca942e79a30dd6e9060f780ec3bd224eba2cf6245eadf3  0.0s
 => CACHED [2/5] RUN adduser --disabled-password --gecos "" appuser                                                0.0s
 => CACHED [3/5] WORKDIR /opt/test-runner                                                                          0.0s
 => CACHED [4/5] COPY . .                                                                                          0.0s
 => CACHED [5/5] RUN GOOS=linux GOARCH=amd64 go build -o /opt/test-runner/bin/test-runner /opt/test-runner         0.0s
 => exporting to image                                                                                             0.0s
 => => exporting layers                                                                                            0.0s
 => => writing image sha256:5cfc55d8ecc943e25b84c84aeeb1bce428d0b4aa1e138e408b1ce6e86567f5aa                       0.0s
 => => naming to docker.io/exercism/go-test-runner                                                                 0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
$ docker run --network none --read-only -v $(pwd)/testdata/practice/gigasecond:/solution -v /tmp:/tmp exercism/go-test-runner gigasecond /solution /tmp
: not foundunner/bin/run.sh: line 2:
: not foundunner/bin/run.sh: line 7:
: not foundunner/bin/run.sh: line 11:
2021/11/10 10:13:01 output_dir does not exist, creating: /tmp
: read-only file systemfailed: mkdir /tmp

However, this seems unrelated to this change.
I'm running in WSL, it may look differently in a native linux system?

@ErikSchierboom
Copy link
Member

That's weird. It looks like /tmp is not being mapped properly. This is the command that I run:

docker run \
    --network none \
    --read-only \
    --mount type=bind,src="${input_dir}",dst=/solution \
    --mount type=bind,src="${output_dir}",dst=/output \
    --mount type=tmpfs,dst=/tmp \
    exercism/go-test-runner "${slug}" /solution /output

With variables replaced of course.

@andrerfcsantos
Copy link
Member Author

Just tested on a linux machine and everything seems fine.

@junedev
Copy link
Member

junedev commented Nov 10, 2021

I tested with the command from the readme on linux.

docker run --network none --read-only -v $(pwd)/testdata/practice/gigasecond:/solution -v /tmp:/tmp exercism/go-test-runner gigasecond /solution /tmp

While it works in the sense that the test runner runs, this is the results.json file:

{
	"status": "error",
	"version": 2,
	"message": "go: go.mod file not found in current directory or any parent directory; see 'go help modules'\n'/usr/local/go/bin/go test --short --json .' returned exit code 1: exit status 1",
	"tests": null
}

Because of the update, none of the testdata folders can be used like this anymore because none of them contains a go.mod file. My tendency would be to add it for all the folders so all of the examples in there are runnable via the container as well. Alternatively, we could only add a go.mod file to the gigasecond folder so that at least this one "full example" works like described in the readme again.
@andrerfcsantos WDYT?

@andrerfcsantos
Copy link
Member Author

andrerfcsantos commented Nov 10, 2021

@junedev I think it's a good idea to add go.mod files to all the folders which need it.

@andrerfcsantos
Copy link
Member Author

Adding the go.mod file to the testdata folders worked.

@andrerfcsantos andrerfcsantos merged commit 7ba1095 into exercism:main Nov 13, 2021
@andrerfcsantos andrerfcsantos deleted the update-go branch November 13, 2021 19:05
@andrerfcsantos andrerfcsantos mentioned this pull request Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/small Small amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants