Skip to content

fix: Ignore staticcheck false positive on darwin#28038

Merged
codingllama merged 1 commit intomasterfrom
codingllama/tpm-golangci
Jun 19, 2023
Merged

fix: Ignore staticcheck false positive on darwin#28038
codingllama merged 1 commit intomasterfrom
codingllama/tpm-golangci

Conversation

@codingllama
Copy link
Copy Markdown
Contributor

staticcheck is too clever for its own good and thinks that HandleTPMActivateCredential only ever returns non-nil. While this is true for darwin, it ain't true in other platforms.

Before the fix (on darwin):

$ golangci-lint run --fast ./tool/tsh/common ./lib/devicetrust/native
tool/tsh/common/device.go:172:17: SA4023: this comparison is always true (staticcheck)
	if cf.Debug && err != nil {
	               ^
tool/tsh/common/device.go:169:2: SA4023(related information): the lhs of the comparison is the 1st return value of this function call (staticcheck)
	err := dtnative.HandleTPMActivateCredential(
	^
lib/devicetrust/native/api.go:60:1: SA4023(related information): github.com/gravitational/teleport/lib/devicetrust/native.HandleTPMActivateCredential never returns a nil interface value (staticcheck)
func HandleTPMActivateCredential(encryptedCredential string, encryptedCredentialSecret string) error {
^

@codingllama codingllama requested a review from strideynet June 19, 2023 17:43
@github-actions github-actions Bot requested review from jakule and xacrimon June 19, 2023 17:43
@github-actions github-actions Bot added size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Jun 19, 2023
@codingllama codingllama added this pull request to the merge queue Jun 19, 2023
@codingllama
Copy link
Copy Markdown
Contributor Author

Thanks for the quick review, folks.

Merged via the queue into master with commit ec8594f Jun 19, 2023
@codingllama codingllama deleted the codingllama/tpm-golangci branch June 19, 2023 19:00
@public-teleport-github-review-bot
Copy link
Copy Markdown

@codingllama See the table below for backport results.

Branch Result
branch/v13 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants