Skip to content

[v13] fix: Ignore staticcheck false positive on darwin#28042

Merged
codingllama merged 1 commit intobranch/v13from
bot/backport-28038-branch/v13
Jun 20, 2023
Merged

[v13] fix: Ignore staticcheck false positive on darwin#28042
codingllama merged 1 commit intobranch/v13from
bot/backport-28038-branch/v13

Conversation

@codingllama
Copy link
Copy Markdown
Contributor

Backport #28038 to branch/v13

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 {
^

@github-actions github-actions Bot requested review from strideynet and zmb3 June 19, 2023 19:05
@github-actions github-actions Bot added backport size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Jun 19, 2023
@codingllama
Copy link
Copy Markdown
Contributor Author

Friendly ping @zmb3 ?

@codingllama codingllama added this pull request to the merge queue Jun 20, 2023
Merged via the queue into branch/v13 with commit eff4503 Jun 20, 2023
@codingllama codingllama deleted the bot/backport-28038-branch/v13 branch June 20, 2023 22:30
@r0mant r0mant mentioned this pull request Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 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