The Internet Home of Jesse Donat Donat Studios

Web Name: The Internet Home of Jesse Donat Donat Studios

WebSite: http://donatstudios.com

ID:93049

Keywords:

Home,Internet,The,

Description:

Go has a problem. Go modules place a strange naming requirement on modules version 2 or greater. Module names on modules v2+ must end in the major version ala …/v2, and communication of this rule has been weak. It's non-obvious, and the community at large does not understand it.I have seen many very large projects including Google owned projects get it wrong. I brought the issue up at my local Go meetup, and no one had ever heard about the rule. They were very skeptical the rule existed at all.A little historyFor a long time Go did not include a built in method for versioning dependencies. It did include the sometimes controversial go get method of fetching packages. The go get tool until recently simply cloned the HEAD of a packages primary branch based on URL and placed it in your $GOPATH. In what has been oft linked to Go's extremist position on backwards compatibility, the expectation was largely that if you published a library, you were expected to maintain compatibility when at all possible. A plethora of tools popped up over the years to fill this void, gopkg.in, glide, and even the at one time official experiment dep.dep was the heir apparent to dependency management with backing from Google. Seemingly suddenly however Russ rsc Cox sprung vgo (aka Go Modules) onto the world as the official Go solution. There was seemingly no input from the community in its creation, to the chagrin of many. Whereas dep was a largely standard dependency manager in the vein of npm and the like, Go modules is a decidedly opinionated Go solution. It's handled as part of the language as a build step. When you go build if you are missing the versioned dependency, the build tool will fetch it.The dependencies requirements are listed in go.mod and the exact versions expected are in go.sum. Both files are in their own sort of domain specific language. The prior has a syntax reminiscent of Go itself. The latter is a space separated list of dependency versions largely not intended to human consumption.The build step will add to these files as necessary, and running go mod tidy will clean them up.The v2+ problem in detailGo modules place a very strange requirement on package developers. When a module hits major version 2 or higher, the module name must end in the major version. The advantage to this is it creates a separate package. The result is that a project can now depend on multiple major versions of the same library.There are two tactics to achieving /v2 modules:The first method is to change the module name in your go.modAn example may seenin the go.mod of github.com/google/go-github seems simple enough, but requires you to also change any cross references within your package. While not the end of the world, it is error prone and even Google missed some. The biggest problem with this method is that it breaks subpackages in non-module-aware versions of Go. As time goes by this becomes less important, but in older versions of Go the package name had to exactly match it's location. https://github.com/pkg/foo could not be github.com/pkg/foo/v2 when there is no v2 directory. The Go Team acknowledging this trouble and patched rudimentary module support into point releases 1.9.7 and 1.10.3 of the Go language to help ease the transition.The second method and the method the Go Team themselves promote is leaving your v1 project as is in the root of your repo, and actually creating a v2/ subfolder containing your v2 library. This feels weird, but the advantage is it works cleanly with older versions of Go that do not understand modules. Off the top of my head I only knew of a single project that went this route, and they appear to have gone back on it.For what it's worth, the official Go Blog tried to clear the situation up some, and posted a write-up about it. blog.golang.org/v2-go-modulesEven as a seasoned developer, I found this write-up somewhat impenetrable. For how important and unusual of a requirement this is, the write-up is not accessible enough.Many projects including Buildkite's terminal-to-html simply didn't know about the requirement until they forget to handle it, and end up publishing broken releases. A v2+ Go library with a go.mod file, but not respecting the module v2+ rules is a compile time error for dependants. This is worse for users than not being being a Go module.Some projects like GORM sidestep the issue entirely by tagging their 2.0 releases as far flung 1.x releases. That something of a solution, but smells terrible.What's to be done?First, I think the Go Team needs to do a better job of shining a light on this rule. They need to scream it from the rooftops. They need at the very least a section of the documentation that lays it out clearly and in layman's terms.Beyond this, there's room for warnings from the Go tooling. Subpackages importing older versions of the root package should throw a warning. It's way too easy an issue to miss.There's room for similar notes on godoc.org / pkg.go.dev, although the usefulness is questionable.The best and least likely option would be for Go to drop the requirement and make it optional. I believe this is a workable solution. Packages who want to allow users to include multiple versions can follow the v2 guidelines, and others don't need to.An option I would personally promote, but is likely never going to happen, is to require /v0 and /v1 as well, such that you'd hit the issue right away rather than years into a project. Teach the convention early.Discussion at: news.ycombinator.com/item?id=24429045 Read More / Comment » Stuck in boring Zoom meetings? Have the perfect gif you want to use as your Zoom Virtual Background , but Zoom won't let you use animated gifs?There's an easy solution - using ffmpeg to convert your GIF to an MP4.You can install ffmpeg with brew or other package manager if you're on a U… Read More / Comment » Almost six years ago I wrote an unintentionally inflammatory post I'd wrongly imagined no one would read: Go Binary Sizes Are Growing out of Control. I had noticed my binaries getting larger and larger as I upgraded versions of Go and wanted to express my frustration.Much has changed since then; th… Read More / Comment » A little under a year ago I wrote a walkthrough: Set up a Self Signed Certificate on macOS's Built in Apache.Recently a new tool showed up called mkcert has come and made life way easier.It's a wonderful tool that instead of building Self-Signed Certificates, sets your local machine up with a cert… Read More / Comment »Why not though? I may not but someone would find it usefulOct. 24, 2020 LinkWith Catalina 10.15 I've added the line below to my ~/.bash_profile:export CPATH="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"Check tw…Oct. 22, 2020 Linkwould it be cool if you could make this a schematica file idk i thik that would be lit for a huge build im about to doOct. 21, 2020 LinkniceOct. 19, 2020 LinkI like circlesOct. 19, 2020 Link Jesse G. Donat It is one thing to insult a man on his character, but to insult a man on his grade of rice, that's another thing entirely. Jesse G. Donat is a Minneapolis based Software Developer who loves all things simple. Lover of Liberty

TAGS:Home Internet The 

<<< Thank you for your visit >>>

Websites to related :
Sturbridge Yankee Workshop

  SAVE UP TO 70% IN CLEARANCE OUTLET, BROWSE NOW! CALL US 1.800.343.1144

Spotting Scope Review Our revie

  Psst! For the best deals any scope or accessory click here. Link updated weekly. Welcome to my blog!Hi I m Don, thanks for stopping by my new web sit

Wortley Top Forge – The oldest

  The kitchen yard complete with the washhouse and the tin bath on a nail in the wall is a sun-trap and a possible picnic area. Our largest breast-shot

Home - Adept Armory

  Home - Adept ArmoryTraining for the Real WorldHomeServicesClass InformationLinksConstruction UpdatesArcheryContactAre you prepared to face the day?We

Welcome to the Adeptia Documenta

  Self-Service Integration for Business People.Secure and Simple.Adeptia Documentation An online documentation for Adeptia users, developers or anyone

ADEPT | Light Aircraft Engines

  Wherever you fly, whatever you fly, get the ADEPT advantages:Economy / Power / Performance / Low Lifecycle Costs ADEPT engines offer the best power-to

Myrmecofourmis.fr fourmis et ins

  Les visiteurs de Myrmecofourmis.fr cherchentcomment chasser les fourmis de la maison, ou comment se débarrasser des poissons d argent, veulent savoir

Hargreaves Lansdown | ISAs, pens

  Our services Funds Shares News HL Insight Newsroom Newsroom articles are published by leading news agencies. Hargreaves Lansdown is not respons

ANM - Association nationale des

  Des professionnels danstous les domaines de compétenceau service de la médiation indépendanteLA PRATIQUE DE LA COMEDIATION par Léonore COUSIN. - C

Les oiseaux de la nature - Porta

  Accueil Portail Rechercher Rechercher Résultats par : Messages Sujets Recherche avancéeS'enregistrer Connexion Les meilleures races de poules pond

ads

Hot Websites