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

fix: watch for changes in replace paths #1323

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

wesbillman
Copy link
Collaborator

@wesbillman wesbillman commented Apr 24, 2024

Fixes #1271

@@ -42,5 +42,3 @@ require (
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)

replace github.com/TBD54566975/ftl => /Users/dli/Development/ftl
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deniseli hopefully this doesn't break anything you were testing before, but assuming we don't want your local path here. Lemme know if you want me to change this back or to something else.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be turned into a relative replace path.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Word! Will update.

@alecthomas alecthomas mentioned this pull request Apr 23, 2024
fullPath := filepath.Join(baseDir, pattern)

// Remove any file-globbing patterns which could include '*' or '**'
var dirPath string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a function in the glob package we use to return the base directory of the glob.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG that would be so nice, this felt so overkill when I was writing it

@@ -42,5 +42,3 @@ require (
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)

replace github.com/TBD54566975/ftl => /Users/dli/Development/ftl
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be turned into a relative replace path.

return nil, fmt.Errorf("failed to parse %s: %w", goModPath, err)
}

replacements := reflect.DeepCopy(goModFile.Replace)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be cleaner to convert this into a map[string]string and pass that around rather than cloning and mutating this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, yeah. Will update. I saw this used in another part of the code like this so assumed there was a reason, but a map would simplify this. Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other location we were updating a go.mod file with changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh 👍

@wesbillman wesbillman force-pushed the watch-replace-package-folders branch from 8d9359e to 29f3c0f Compare April 24, 2024 23:44
@alecthomas
Copy link
Collaborator

Is this going in?

@wesbillman
Copy link
Collaborator Author

I was waiting for the other repo to be upgradable so I could test this change a bit before merging. Testing and merging today.

@wesbillman wesbillman force-pushed the watch-replace-package-folders branch from 29f3c0f to 08644bf Compare April 29, 2024 14:40
@wesbillman wesbillman marked this pull request as ready for review April 29, 2024 14:41
@wesbillman wesbillman requested a review from a team as a code owner April 29, 2024 14:41
@wesbillman wesbillman requested review from AlexSzlavik and removed request for a team April 29, 2024 14:41
@wesbillman wesbillman merged commit ff1e609 into main Apr 29, 2024
11 checks passed
@wesbillman wesbillman deleted the watch-replace-package-folders branch April 29, 2024 14:45
@alecthomas
Copy link
Collaborator

😍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FTL file watching should follow replace directives in go.mod
2 participants