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

Expanded codegen version mismatch error. #431

Merged
merged 1 commit into from
Jul 5, 2023
Merged

Conversation

mwhittaker
Copy link
Member

Recall that weaver generate embeds its codegen API version in the weaver_gen.go files it generates. If these files are compiled with a different codegen API version, the code fails to build, and a helpful error message is shown to the user. Before this PR, the error message looked like this:

You used 'weaver generate' codegen version 0.17.0, but you built your
code with an incompatible weaver module version. Try upgrading 'weaver
generate' and re-running it.

Now, it looks like this:

ERROR: You generated this file with 'weaver generate' v0.17.0 (codegen
version v0.17.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.

The old error message allowed people to ask us for help, and we could tell them how to fix it. The new error message should hopefully allow people to understand and fix the bug on their own.

@mwhittaker mwhittaker requested a review from spetrovic77 June 29, 2023 19:55
@mwhittaker mwhittaker self-assigned this Jun 29, 2023
mwhittaker added a commit that referenced this pull request Jun 29, 2023
Recall that when a deployer deploys a binary, it first extracts the
deployer API version from the binary and checks that its deployer API
version is compatible. Before this PR, the resulting error message
looked like this:

```
version mismatch: deployer's deployer API version v0.17.0 is
incompatible with app' deployer API version v0.14.0
```

Now, it looks like this:

```
ERROR: The binary you're trying to deploy ("collatz") was built with
github.com/ServiceWeaver/weaver module version v0.17.0 (deployer API
version v0.14.0). However, the 'weaver multi' binary you're using was built
with weaver module version v0.17.0 (deployer API version v0.15.0). These
versions are incompatible.

We recommend updating both the weaver module your application is built with and
updating the 'weaver multi' command by running the following.

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

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

This PR also makes the multi and ssh deployers check these versions
earlier, before trying to deploy anything.

See #431 for a similar PR.
mwhittaker added a commit that referenced this pull request Jun 29, 2023
Recall that when a deployer deploys a binary, it first extracts the
deployer API version from the binary and checks that its deployer API
version is compatible. Before this PR, the resulting error message
looked like this:

```
version mismatch: deployer's deployer API version v0.17.0 is
incompatible with app' deployer API version v0.14.0
```

Now, it looks like this:

```
ERROR: The binary you're trying to deploy ("collatz") was built with
github.com/ServiceWeaver/weaver module version v0.17.0 (deployer API
version v0.14.0). However, the 'weaver multi' binary you're using was built
with weaver module version v0.17.0 (deployer API version v0.15.0). These
versions are incompatible.

We recommend updating both the weaver module your application is built with and
updating the 'weaver multi' command by running the following.

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

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

This PR also makes the multi and ssh deployers check these versions
earlier, before trying to deploy anything.

See #431 for a similar PR.
Copy link
Contributor

@spetrovic77 spetrovic77 left a comment

Choose a reason for hiding this comment

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

Nice!

@mwhittaker mwhittaker force-pushed the codegen_version_error branch from 1e58cb8 to cf2a0d8 Compare July 5, 2023 17:04
Recall that 'weaver generate' embeds its codegen API version in the
weaver_gen.go files it generates. If these files are compiled with a
different codegen API version, the code fails to build, and a helpful
error message is shown to the user. Before this PR, the error message
looked like this:

```
You used 'weaver generate' codegen version 0.17.0, but you built your
code with an incompatible weaver module version. Try upgrading 'weaver
generate' and re-running it.
```

Now, it looks like this:

```
ERROR: You generated this file with 'weaver generate' v0.17.0 (codegen
version v0.17.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.
```

The old error message allowed people to ask us for help, and we could
tell them how to fix it. The new error message should hopefully allow
people to understand and fix the bug on their own.
@mwhittaker mwhittaker force-pushed the codegen_version_error branch from cf2a0d8 to 5256462 Compare July 5, 2023 17:05
@mwhittaker mwhittaker merged commit f11666a into main Jul 5, 2023
@mwhittaker mwhittaker deleted the codegen_version_error branch July 5, 2023 17:11
mwhittaker added a commit that referenced this pull request Jul 5, 2023
Recall that when a deployer deploys a binary, it first extracts the
deployer API version from the binary and checks that its deployer API
version is compatible. Before this PR, the resulting error message
looked like this:

```
version mismatch: deployer's deployer API version v0.17.0 is
incompatible with app' deployer API version v0.14.0
```

Now, it looks like this:

```
ERROR: The binary you're trying to deploy ("collatz") was built with
github.com/ServiceWeaver/weaver module version v0.17.0 (deployer API
version v0.14.0). However, the 'weaver multi' binary you're using was built
with weaver module version v0.17.0 (deployer API version v0.15.0). These
versions are incompatible.

We recommend updating both the weaver module your application is built with and
updating the 'weaver multi' command by running the following.

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

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

This PR also makes the multi and ssh deployers check these versions
earlier, before trying to deploy anything.

See #431 for a similar PR.
mwhittaker added a commit that referenced this pull request Jul 5, 2023
Recall that when a deployer deploys a binary, it first extracts the
deployer API version from the binary and checks that its deployer API
version is compatible. Before this PR, the resulting error message
looked like this:

```
version mismatch: deployer's deployer API version v0.17.0 is
incompatible with app' deployer API version v0.14.0
```

Now, it looks like this:

```
ERROR: The binary you're trying to deploy ("collatz") was built with
github.com/ServiceWeaver/weaver module version v0.17.0 (deployer API
version v0.14.0). However, the 'weaver multi' binary you're using was built
with weaver module version v0.17.0 (deployer API version v0.15.0). These
versions are incompatible.

We recommend updating both the weaver module your application is built with and
updating the 'weaver multi' command by running the following.

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

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

This PR also makes the multi and ssh deployers check these versions
earlier, before trying to deploy anything.

See #431 for a similar PR.
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