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

feat: add consumer migration tool #226

Merged
merged 18 commits into from
Mar 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix prefix mangling
guseggert committed Mar 27, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
guseggert Gus Eggert
commit a0ef732153eedb7fd32e187f76f5587ca03dc74e
8 changes: 5 additions & 3 deletions cmd/migrate/migrate.go
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import (
)

var importChanges = map[string]string{
"github.com/ipfs/go-bitswap": "github.com/ipfs/go-libipfs/bitswap",
"github.com/ipfs/go-bitswap": "github.com/ipfs/go-libipfs/bitswap",
"github.com/ipfs/go-ipfs-files": "github.com/ipfs/go-libipfs/files",
"github.com/ipfs/tar-utils": "github.com/ipfs/go-libipfs/tar",
"gihtub.com/ipfs/go-block-format": "github.com/ipfs/go-libipfs/blocks",
@@ -83,9 +83,11 @@ func updateImports(filePath string, dryRun bool) error {
// we take the first matching prefix, so you need to make sure you don't have ambiguous mappings
for from, to := range importChanges {
if strings.HasPrefix(val, from) {
fmt.Printf("changing %s => %s in %s\n", x.Path.Value, to, filePath)
suffix := strings.TrimPrefix(val, from)
newVal := to + suffix
fmt.Printf("changing %s => %s in %s\n", x.Path.Value, newVal, filePath)
if !dryRun {
x.Path.Value = fmt.Sprintf(`"%s"`, to)
x.Path.Value = fmt.Sprintf(`"%s"`, newVal)
fileChanged = true
}
}