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

fix: docker image #1356

Closed
wants to merge 1 commit into from
Closed

Conversation

alesbrelih
Copy link
Contributor

@alesbrelih alesbrelih commented Dec 2, 2024

Changed docker image from scratch to golang because with golang/x/tools lift from v0.26.0 to v0.27.0 there was a breaking change of retrieving golang env variables using go executable.

Which breaks ogen in scratch image as go isn't available.

Error:

docker run --rm \
  --volume ".:/workspace" \
  ogen5 --target workspace/petstore --clean workspace/petstore.yml
INFO    convenient      Convenient errors are not available     {"reason": "operation has no \"default\" response", "at": "petstore.yml:56:9"}
WARN    Header name is not canonical, canonical name will be used       {"at": "petstore.yml:196:11", "original_name": "api_key", "canonical_name": "Api_key"}
generate:
    main.run
        /go/src/app/cmd/ogen/main.go:379
  - write:
    main.generate
        /go/src/app/cmd/ogen/main.go:100
  - template "schemas":
    github.com/ogen-go/ogen/gen.(*Generator).WriteSource.(*Generator).WriteSource.func1.func2
        /go/src/app/gen/write.go:299
  - goimports:
  - err: go command required, not found: exec: "go": executable file not found in $PATH: stderr:

@alesbrelih
Copy link
Contributor Author

alesbrelih commented Dec 2, 2024

Nevermind, went a bit deeper into the rabbit hole.
Autoimports were already enabled. Problem is that they added an additional logic when checking imports to be fixed inside:
getFIxes func. Now they invoke go to get go env variables using goEnv, err := env.goEnv(). Relevant MR: golang/tools@cceaf96#diff-05cab7fa801ce49d3d9a722a26809eb264b04da83e4a667a1100793ff2e9bdbbR572

Changes are in internal/imports/fix.go so it doesn't automatically jumps to diff. You need to expand it first.

I see no other way than moving from scratch image from the moment.

Changed docker image from scratch to golang because with golang/x/tools
lift from v0.26.0 to v0.27.0 there was a breaking change of
of retrieving golang env variables using go executable. Which breaks
ogen in scratch image as go isn't available.
@alesbrelih
Copy link
Contributor Author

Closing because it was already fixed on main branch.

@alesbrelih alesbrelih closed this Dec 3, 2024
@alesbrelih alesbrelih deleted the fix/docker-image branch December 3, 2024 10:51
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.

1 participant