You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a sample program,saved as myatomic.go, here is source code:
package main
import (
"fmt"
"sync/atomic"
)
func main() {
var i uint64 = 0
i = atomic.AddUint64(&i, 1)
fmt.Println(i)
}
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
What did you expect to see?
I wish know how I fix "direct assignment to atomic value".
Thanks very much.
What did you see instead?
I run it with command:go run myatomic.go, then return 1 to me. It's ok.
BUT, when command is go vet myatomic.go, it runs error.
Here is console detail:
[root@iZm5egf7xb48axmu4z1t3fZ GoTestExample]# go run myatomic.go
1
[root@iZm5egf7xb48axmu4z1t3fZ GoTestExample]# go vet myatomic.go
myatomic.go:10: direct assignment to atomic value
exit status 1
Besh wishs!~
The text was updated successfully, but these errors were encountered:
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9 linux/amd64
Does this issue reproduce with the latest release?
YES.
What operating system and processor architecture are you using (
go env
)?What did you do?
This is a sample program,saved as
myatomic.go
, here is source code:If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
What did you expect to see?
I wish know how I fix "direct assignment to atomic value".
Thanks very much.
What did you see instead?
I run it with command:
go run myatomic.go
, then return1
to me. It's ok.BUT, when command is
go vet myatomic.go
, it runs error.Here is console detail:
Besh wishs!~
The text was updated successfully, but these errors were encountered: