#Update on packagingvanity URLs

1 messages · Page 1 of 1 (latest)

terse pine
#

Proof, from a brand new repo:

# brand new module
$ go mod init github.com/aluzzardi/importtest
go: creating new go.mod: module github.com/aluzzardi/importtest
go: to add module requirements and sums:
    go mod tidy

# buildkit crap
$ go mod edit -replace=github.com/docker/docker=github.com/docker/docker@v20.10.3-0.20220414164044-61404de7df1a+incompatible

# `main.go` is importing the SDK, `go mod tidy` finds everything
$ go mod tidy
go: finding module for package go-vanity-test.netlify.app/dagger/sdk/go/dagger
go: downloading go-vanity-test.netlify.app/dagger/sdk/go v0.1.0-alpha.10
go: found go-vanity-test.netlify.app/dagger/sdk/go/dagger in go-vanity-test.netlify.app/dagger/sdk/go v0.1.0-alpha.10
go: downloading go-vanity-test.netlify.app/dagger v0.3.0-alpha.8
#

(go-vanity-test.netlify.app/dagger is my own dagger.io/dagger for testing)

#

(in the snippet above: Go SDK was released as v0.1.0-alpha.10, dagger as v0.3.0-alpha.8)

deft sable
#

I guess Option X means same version for all SDKs since we'll use tags? If we distribute the python / node packages via git, it means bumping all SDKs everytime there is a change.

#

Given we might release often initially it might be ok. And it does not prevent us to split the repos later (the upgrade migration for users will be a pain though...)

clear inlet
#

In option X do we need to version EVERYTHING in lockstep or only go sdk + engine?

If it’s everything, we will have a cue sdk version 0.3 that depends on engine 0.2. Which is not a deal breaker but we need to be ok with communicating that (can’t sweep it under the rug)

terse pine
#

Yeah, that's the only difference between the options:

Option X: same version, same go.mod

Option Z: different versions, different go.mod

#

both options have the same import path

clear inlet
#

in option X what would be the import path?

#

oh I see /sdk/go/dagger

#

😖

#

so only way to get sdk at dagger.io/dagger is to split repos?

terse pine
#

yes

clear inlet
#

Sorry if I asked this before but: wouldn't it be possible to just move the engine go.mod from the root to ./engine? That way there would be 2 go.mods, but they would be side by side rather than nested.

Aside from changing import paths from github.com/dagger/dagger to github.com/dagger/dagger/engine, everything would be pretty smooth: one monorepo, separate versioning of everything, short vanity url for the sdk... No?

I'm guessing I'm missing something important

obsidian cedar
#

@clear inlet I'm pretty sure the main sticking point is that sub folders + vanity urls don't work nicely together. So I think that would just move the problem around.

clear inlet
#

Ah ok, I read "submodules" but maybe it was really "modules in a subfolder"

obsidian cedar
obsidian cedar
terse pine
#

that's the constant

fiery kindle
#

Modules in subfolders are fine as long as you have complete control over who imports those packages. Otherwise you lock yourself in forever ot that particular structure.

For example if you add a new module under a path that was already a module before and two different packages import those two modules, Go will go nuts saying that in one case it's a module, but not in the other and it won't be able to decide which module to import in order to use that package.

I've burnt myself quite a few times with this, so unless it's absolutely necessary or you aren't absolutely sure there won't be any changes in the module structure, I would avoid modules in subdirectories.

#

I wrote about vanity imports a while ago: https://sagikazarmark.hu/blog/vanity-import-paths-in-go/

+1 for using vanity imports!

noble tapir
#

Resurrecting this 2 year old thread for some good news - support for vanity URLs pointing to subpaths is on the way: https://go-review.googlesource.com/c/go/+/625577

Once this ships we can get rid of the dagger/dagger-go-sdk repo. Might simplify our release process a bit? /cc @daring wing