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

Refactor: Extract say to its own file #312

Merged
merged 3 commits into from
Sep 21, 2022
Merged

Conversation

gregorriegler
Copy link
Collaborator

A first step tackling #296

@hollesse
Copy link
Member

I really like the idea, but I would have expected it to be its own package and export just few functions and not all. What do you think about this?

Copy link
Member

@hollesse hollesse left a comment

Choose a reason for hiding this comment

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

I think we should use a different package and have some functions private

say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
say.go Outdated Show resolved Hide resolved
@gregorriegler
Copy link
Collaborator Author

You're just teaching me some go, and I love it!

@gregorriegler
Copy link
Collaborator Author

gregorriegler commented Sep 20, 2022

I'm stuck. The tests finish with an exit code and I don't know why.
Do you have any Idea @hollesse ?

@gregorriegler
Copy link
Collaborator Author

Ok, I understand now. Trying to find a solution

@gregorriegler
Copy link
Collaborator Author

solved

coauthors.go Show resolved Hide resolved
say/say.go Outdated Show resolved Hide resolved
say/say.go Show resolved Hide resolved
say/say_test.go Outdated Show resolved Hide resolved
squash_wip.go Outdated Show resolved Hide resolved
@gregorriegler
Copy link
Collaborator Author

"Error: ./mob.go:1150:3: undefined: sayFix"

this is not the version I would have liked it to use.

@gregorriegler
Copy link
Collaborator Author

ok, we got this.

@@ -664,55 +654,55 @@ func printDeprecatedDoneSquashMessage(value string) {

if unquotedValue == "true" || unquotedValue == "false" {
newValue := doneSquash(unquotedValue)
say("MOB_DONE_SQUASH is set to the deprecated value " + value + ". Use the value " + newValue + " instead.")
say.Say("MOB_DONE_SQUASH is set to the deprecated value " + value + ". Use the value " + newValue + " instead.")
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a Warning?

}
}

func removed(key string, message string) {
if _, set := os.LookupEnv(key); set {
say("Configuration option '" + key + "' is no longer used.")
say(message)
say.Say("Configuration option '" + key + "' is no longer used.")
Copy link
Member

Choose a reason for hiding this comment

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

This can also be a Warning

say("Configuration option '" + key + "' is no longer used.")
say(message)
say.Say("Configuration option '" + key + "' is no longer used.")
say.Say(message)
Copy link
Member

Choose a reason for hiding this comment

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

same here

}
}

func deprecated(key string, message string) {
if _, set := os.LookupEnv(key); set {
say("Configuration option '" + key + "' is deprecated.")
say(message)
say.Say("Configuration option '" + key + "' is deprecated.")
Copy link
Member

Choose a reason for hiding this comment

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

same here

say("Configuration option '" + key + "' is deprecated.")
say(message)
say.Say("Configuration option '" + key + "' is deprecated.")
say.Say(message)
Copy link
Member

Choose a reason for hiding this comment

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

same here

}
}

func experimental(key string) {
if _, set := os.LookupEnv(key); set {
say("Configuration option '" + key + "' is experimental. Be prepared that this option will be removed!")
say.Say("Configuration option '" + key + "' is experimental. Be prepared that this option will be removed!")
Copy link
Member

Choose a reason for hiding this comment

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

same here

@@ -877,10 +867,10 @@ func (branch Branch) isOrphanWipBranch(configuration Configuration) bool {
}

func branch(configuration Configuration) {
say(silentgit("branch", "--list", "--remote", newBranch("*").addWipPrefix(configuration).remote(configuration).Name))
say.Say(silentgit("branch", "--list", "--remote", newBranch("*").addWipPrefix(configuration).remote(configuration).Name))
Copy link
Member

Choose a reason for hiding this comment

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

does that make sense? why don't we use git instead of say.Say(silentgit(...))


// DEPRECATED
say(silentgit("branch", "--list", "--remote", newBranch("mob-session").remote(configuration).Name))
say.Say(silentgit("branch", "--list", "--remote", newBranch("mob-session").remote(configuration).Name))
Copy link
Member

Choose a reason for hiding this comment

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

same here

@gregorriegler
Copy link
Collaborator Author

I agree with all the points you made, however it is not a part of the change I'm trying to make in this pr. I just want to move say to its own package. We should improve how say is used, but that's another step. Let's make small steps and integrate often.

@hollesse
Copy link
Member

I agree. That's why I approved the PR but leaved the comments.

@gregorriegler
Copy link
Collaborator Author

Ah, I didn't get that. So I'll merge it then.

@gregorriegler gregorriegler merged commit cb0d5c3 into main Sep 21, 2022
@simonharrer simonharrer deleted the refactor-extract-say branch November 30, 2022 07:47
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.

2 participants