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

Make staticcheck great again #3103

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

alexshtin
Copy link
Member

What changed?
Make staticcheck great again.

Why?
To enable automatic static analysis.

How did you test it?
make staticcheck

Potential risks
No risks.

Is hotfix candidate?
No.

@alexshtin alexshtin requested a review from a team as a code owner July 14, 2022 19:12
Copy link
Member

@dnr dnr left a comment

Choose a reason for hiding this comment

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

I stopped at 83/165 files, will do the rest later

common/archiver/filestore/queryParser.go Outdated Show resolved Hide resolved
common/archiver/gcloud/queryParser.go Outdated Show resolved Hide resolved
common/archiver/s3store/queryParser.go Outdated Show resolved Hide resolved
common/dynamicconfig/cmp.go Show resolved Hide resolved
@@ -40,7 +40,7 @@ func NewDataBlob(data []byte, encodingTypeStr string) *commonpb.DataBlob {
encodingType, ok := enumspb.EncodingType_value[encodingTypeStr]
if !ok || (enumspb.EncodingType(encodingType) != enumspb.ENCODING_TYPE_PROTO3 &&
enumspb.EncodingType(encodingType) != enumspb.ENCODING_TYPE_JSON) {
panic(fmt.Sprintf("Invalid encoding: \"%v\"", encodingTypeStr))
panic(fmt.Sprintf("Invalid encoding: %v", encodingTypeStr))
Copy link
Member

Choose a reason for hiding this comment

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

maybe %q?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it but I don't like %q. Because everytime we log the error in JSON logger (which is default) it gets only worse.

common/persistence/sql/shard.go Outdated Show resolved Hide resolved
@alexshtin alexshtin force-pushed the fix/enable-staticcheck branch 2 times, most recently from ba838d9 to 5aa58a7 Compare July 14, 2022 20:33
service/history/timerQueueStandbyTaskExecutor.go Outdated Show resolved Hide resolved
@@ -1209,32 +1212,6 @@ func (e *MutableStateImpl) DeleteUserTimer(
return nil
}

// nolint:unused
Copy link
Member

Choose a reason for hiding this comment

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

hey, I removed this first in #3055 🙂

@@ -4566,7 +4543,7 @@ func (e *MutableStateImpl) createCallerError(
return serviceerror.NewInvalidArgument(msg)
}

func (_ *MutableStateImpl) unixNanoToTime(
func (*MutableStateImpl) unixNanoToTime(
Copy link
Member

Choose a reason for hiding this comment

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

move this into common/primitives/timestamp or common/util?

Copy link
Member Author

Choose a reason for hiding this comment

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

3 usages of this function are:

e.unixNanoToTime(now.UnixNano())

🤦

@alexshtin alexshtin merged commit 8d82a8c into temporalio:master Jul 15, 2022
@alexshtin alexshtin deleted the fix/enable-staticcheck branch July 15, 2022 17:01
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