Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load sdk version from buildinfo (#521)
Currently, line-bot-sdk-go embeds the library version defined in `version.go` as the user-agent, so `version.go` is updated manually or forcibly at release time to avoid manual operation. And we define a github workflow to push tag forcibly to automate (1) updating `version.go` and (2)fix git tag. Because of this, GitHub's branch protection cannot be used. (we can solve this by using PAT, but we don't want to use it) Since Go 1.18, https://pkg.go.dev/debug/buildinfo has been provided. By using runtime/debug, library(like line-bot-sdk-go) can obtain the library's own version from the runtime of the library user. Since the latest version of line-bot-sdk-go only supports Go 1.22 and above, this feature should be usable. In the user's environment, the version of line-bot-sdk-go is retrieved from buildinfo only once in runtime. There's no point in recalculating it each time since the same value should be obtained every time. Excluding meaningless mocks, tests in this repository cannot be written. I created minimum example for this patch. - https://github.com/Yang-33/line-bot-sdk-go-521-lib - https://github.com/Yang-33/line-bot-sdk-go-521-app
- Loading branch information