Adding and using Go module library minor versions (major versions > 2)

PHPz
Release: 2024-02-05 22:03:12
forward
565 people have browsed it

添加和使用 Go 模块库次要版本(主要版本 > 2)

Question content

I have been working on converting our private library into a go module and have overcome the new issues of publishing and using the library Initial hurdles to major releases (e.g. tssgit.reyrey.com/teschste/go-httpmailer/v3).

However, I now need to release an update of the library from v3.0.0 to v3.1.0 and I'm running into a problem. My understanding, based on the information I've found online, is that I keep the declaration in the same module tssgit.reyrey.com/teschste/go-httpmailer/v3 in my go.mod and simply publish new version. I can see the new version in our repository: [I tried adding an image to show it but for some reason it won't add]

When I try to use this new version in my application, I first try:

go get tssgit.reyrey.com/teschste/go-httpmailer/v3
Copy after login

but failed:

go: module tssgit.reyrey.com/teschste/go-httpmailer@upgrade found (v2.1.0+incompatible), but does not contain package tssgit.reyrey.com/teschste/go-httpmailer/v3
Copy after login

Then I tried:

go get tssgit.reyrey.com/teschste/go-httpmailer/[email protected]
Copy after login

but failed:

go: tssgit.reyrey.com/teschste/go-httpmailer/[email protected]: invalid version: go.mod has non-.../v3 module path "tssgit.reyrey.com/teschste/go-httpmailer/v3.1" (and .../v3/go.mod does not exist) at revision v3.1.0
Copy after login

There is a lot of information online about setting up a major version, but so far I haven't found anything that solves my specific problem. I'm sure I'm missing something simple, but currently I don't know what it is. Any help would be greatly appreciated!


Correct answer


After some more googling, I asked for some help from others internally to make sure I wasn't just missing something obvious, And they don't have the same problem. We tried a few things, but it came down to something in my installation that was causing it to fail (don't know what), so I uninstalled Go, uninstalled git, reinstalled Go, then reinstalled git, after clearing After reinstalling the configuration issue, my problem disappeared. I wish I had a better answer, but I don't.

Hope no one else needs to go through this.

The above is the detailed content of Adding and using Go module library minor versions (major versions > 2). For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template