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

Dockerize gofumpt #236

Merged
merged 4 commits into from
Oct 5, 2022
Merged

Conversation

gauravgahlot
Copy link
Contributor

Fixes - #224

Manual Test

I intentionally added a new line at the function start to test if the make fmt or docker-compose run still fixes it.

func TestTimeseries(t *testing.T) {

	t.Parallel()
	t.Run("chunks where end date is before last iteration", func(t *testing.T) {
		t.Parallel()

Test with docker-compose:

gidari on main [!?] via 🐹 v1.18.4 on 🐳 v20.10.17 at ☸️  microk8s
➜ docker-compose up -d fmt
[+] Building 0.1s (7/7) FINISHED
 => [internal] load build definition from fmt.Dockerfile                                                                                                                                              0.0s
 => => transferring dockerfile: 36B                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 34B                                                                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/golang:1.19-alpine                                                                                                                                 0.0s
 => [1/3] FROM docker.io/library/golang:1.19-alpine                                                                                                                                                   0.0s
 => CACHED [2/3] WORKDIR /app                                                                                                                                                                         0.0s
 => CACHED [3/3] RUN go install mvdan.cc/gofumpt@latest                                                                                                                                               0.0s
 => exporting to image                                                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                                                               0.0s
 => => writing image sha256:2deccab2d68769b0ae774aeedfc4a6fc9905f3664d6ec2bee66893244a9783fb                                                                                                          0.0s
 => => naming to docker.io/library/gidari-fmt                                                                                                                                                         0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 1/1
 ⠿ Container gidari-fmt-1  Started                                                                                                                                                                    0.3s

gidari on main [!?] via 🐹 v1.18.4 on 🐳 v20.10.17 at ☸️  microk8s
➜ docker ps -a
CONTAINER ID   IMAGE        COMMAND             CREATED         STATUS                     PORTS     NAMES
8c2453da51a2   gidari-fmt   "gofumpt -l -w ."   5 seconds ago   Exited (0) 5 seconds ago             gidari-fmt-1

gidari on main [!?] via 🐹 v1.18.4 on 🐳 v20.10.17 at ☸️  microk8s
➜ docker logs 8c2453da51a2
internal/transport/transport_test.go

Test with make fmt

gidari on main [!?] via 🐹 v1.18.4 on 🐳 v20.10.17 at ☸️  microk8s
➜ make fmt
docker build -t gofumpt -f scripts/fmt.Dockerfile .
[+] Building 0.1s (7/7) FINISHED
 => [internal] load build definition from fmt.Dockerfile                                                                                                                                                0.0s
 => => transferring dockerfile: 41B                                                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                                                       0.0s
 => => transferring context: 34B                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/golang:1.19-alpine                                                                                                                                   0.0s
 => [1/3] FROM docker.io/library/golang:1.19-alpine                                                                                                                                                     0.0s
 => CACHED [2/3] WORKDIR /app                                                                                                                                                                           0.0s
 => CACHED [3/3] RUN go install mvdan.cc/gofumpt@latest                                                                                                                                                 0.0s
 => exporting to image                                                                                                                                                                                  0.0s
 => => exporting layers                                                                                                                                                                                 0.0s
 => => writing image sha256:2deccab2d68769b0ae774aeedfc4a6fc9905f3664d6ec2bee66893244a9783fb                                                                                                            0.0s
 => => naming to docker.io/library/gofumpt                                                                                                                                                              0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
docker run -t -v /Users/gaurav.gahlot/go/src/github.com/gauravgahlot/gidari:/app gofumpt
internal/transport/transport_test.go
golangci-lint run --fix
WARN [linters context] contextcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.

@gauravgahlot
Copy link
Contributor Author

@prestonvasquez Ready for review.

@prestonvasquez prestonvasquez self-requested a review October 5, 2022 14:28
@prestonvasquez
Copy link
Contributor

@gauravgahlot Brilliant! Thank you for this contribution ❤️

@prestonvasquez prestonvasquez merged commit 59f1db4 into alpstable:main Oct 5, 2022
@gauravgahlot gauravgahlot deleted the docker-go-fmt branch October 6, 2022 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants