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

feature: modify existed comments if necessary #16

Merged
merged 11 commits into from
Jun 10, 2022

Conversation

Bin-Huang
Copy link
Contributor

@Bin-Huang Bin-Huang commented Jun 10, 2022

Add the missed name prefix to the existed comment

Original code:

// find user from database
func FindUser() {
}

Using gocmt give you:

// FindUser find user from database
func FindUser() {
}

Make existed comment to fit the template

Original code:

// User
type User struct {
}

Using gocmt give you:

// User ...
type User struct {
}

Works well in multi-line comment

Original code:

// it causes when a connection failed.
// you should retry the query in most time.
var ConnectFailed = errors.new("failed to connect")

Using gocmt give you:

// QueryFailed it causes when a connection failed.
// you should retry the query in most time.
var QueryFailed = errors.new("failed to query")

Take care of the marker comment

Original code:

//go:embed storage/*
var LocalCache embed.FS

// never change this manually
//go:generate goyacc -o gopher.go -p parser gopher.y
func Generate() {
}

//binding:config-maker
type Maker struct {}

Using gocmt give you:

// LocalCache ...
//go:embed storage/*
var LocalCache embed.FS

// Generate never change this manually
//go:generate goyacc -o gopher.go -p parser gopher.y
func Generate() {
}

// Maker ...
//binding:config-maker
type Maker struct {}

@Bin-Huang Bin-Huang changed the title feature: modify comments if necessary feature: modify existed comments if necessary Jun 10, 2022
@Bin-Huang
Copy link
Contributor Author

Bin-Huang commented Jun 10, 2022

@cuonglm @mwlazlo @lirao Thanks for the review, I am waiting for any suggestions 😉

@cuonglm
Copy link
Owner

cuonglm commented Jun 10, 2022

@Bin-Huang Thanks for the PR!

I will take a look once I'm back to my laptop. But it's easier if you can split the PR into multiple ones, witch each of them implement 1 feature only.

Thank you!

@Bin-Huang
Copy link
Contributor Author

@Bin-Huang Thanks for the PR!

I will take a look once I'm back to my laptop. But it's easier if you can split the PR into multiple ones, witch each of them implement 1 feature only.

Thank you!

Actually there is only 1 feature here. And I just wrote 3 notes about this feature above. Maybe my issue layout is confused. 😄

@Bin-Huang
Copy link
Contributor Author

By the way, the new version gocmt in this PR works very well in our two huge code repositories. It can show that the new version is well-tested.

@cuonglm
Copy link
Owner

cuonglm commented Jun 10, 2022

@Bin-Huang Thanks for clarifying and your contribution, LGTM!

@cuonglm cuonglm merged commit 29e0a6b into cuonglm:main Jun 10, 2022
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