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

Clarify "weaver generate" version error message. #542

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

mwhittaker
Copy link
Member

Recall that weaver generate generates code to check, at compile time, that the codegen version used by weaver generate is the same as the codegen version linked into the application. This check includes a lengthy error message that is shown to the user when they try to go build or go run with a mismatched codegen version:

ERROR: You generated this file with 'weaver generate' v0.20.0 (codegen
version v0.20.0). The generated code is incompatible with the version of the
github.com/ServiceWeaver/weaver module that you're using. The weaver module
version can be found in your go.mod file or by running the following command.

    go list -m github.com/ServiceWeaver/weaver

We recommend updating the weaver module and the 'weaver generate' command by
running the following.

    go get github.com/ServiceWeaver/weaver@latest
    go install github.com/ServiceWeaver/weaver/cmd/weaver@latest

Then, re-run 'weaver generate' and re-build your code. If the problem persists,
please file an issue at https://github.com/ServiceWeaver/weaver/issues.

People were reading weaver_gen.go and seeing this error message, thinking that something went wrong with weaver generate. This PR tries to clarify the situation in two ways.

  1. I moved the generated error message to the middle of weaver_gen.go. Before it was at the very top, and people saw it immediately when opening weaver_gen.go. Now, it's buried more in the middle, making it less likely for people to read it.
  2. I added a comment above the error message explaining that it's nothing to worry about.

@mwhittaker mwhittaker requested a review from rgrandl August 18, 2023 17:06
@mwhittaker mwhittaker self-assigned this Aug 18, 2023
Copy link
Contributor

@rgrandl rgrandl left a comment

Choose a reason for hiding this comment

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

Nice, can't imagine how many people got into this and they thought that something is wrong.

@mwhittaker mwhittaker force-pushed the clarify_error_message branch from dc03d0a to d54189b Compare August 23, 2023 16:46
Recall that `weaver generate` generates code to check, at compile time,
that the codegen version used by `weaver generate` is the same as the
codegen version linked into the application. This check includes a
lengthy error message that is shown to the user when they try to `go
build` or `go run` with a mismatched codegen version:

```
ERROR: You generated this file with 'weaver generate' v0.20.0 (codegen
version v0.20.0). The generated code is incompatible with the version of the
github.com/ServiceWeaver/weaver module that you're using. The weaver module
version can be found in your go.mod file or by running the following command.

    go list -m github.com/ServiceWeaver/weaver

We recommend updating the weaver module and the 'weaver generate' command by
running the following.

    go get github.com/ServiceWeaver/weaver@latest
    go install github.com/ServiceWeaver/weaver/cmd/weaver@latest

Then, re-run 'weaver generate' and re-build your code. If the problem persists,
please file an issue at https://github.com/ServiceWeaver/weaver/issues.
```

People were reading `weaver_gen.go` and seeing this error message,
thinking that something went wrong with `weaver generate`. This PR tries
to clarify the situation in two ways.

1. I moved the generated error message to the middle of `weaver_gen.go`.
   Before it was at the very top, and people saw it immediately when
   opening `weaver_gen.go`. Now, it's buried more in the middle, making
   it less likely for people to read it.
2. I added a comment above the error message explaining that it's
   nothing to worry about.
@mwhittaker mwhittaker force-pushed the clarify_error_message branch from d54189b to 799081c Compare August 23, 2023 17:07
@mwhittaker mwhittaker merged commit cd9ca65 into main Aug 23, 2023
@mwhittaker mwhittaker deleted the clarify_error_message branch August 23, 2023 17:12
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.

2 participants