This is a created article in which the information may have evolved or changed.
Golang this artifact, the operating system data should be the simplest, a friend in the group is asking such a question. He was in the operation of the prompt insufficient permission, I found in the following test the root cause of the problem
Package Mainimport ("FMT" "Log" Registry "Github.com/golang/sys/windows/registry") func main () {k, err: = registry. Openkey (registry. Local_machine, ' Sam\xiao ', registry. all_access) If err! = Nil {log. Fatal (Err)}defer k.close () s, _, Err: = K.getstringvalue ("x") if err! = Nil {log. Fatal (Err)}fmt. Printf ("%q\n", s)}
The code I tested above
If you say that there are no permissions in this registry, you will be prompted for insufficient permissions
But I'll give it a permission to assign a value below.
Specifically like the study of friends. You can try it yourself.
Below is what permissions, manual Click Jump This jump is need to turn over the wall
He's here to tell us. If you need detailed registry key security and access rights explanation you can go see the Microsoft side.
Click to jump Microsoft registration rights Introduction
By comparing the 16 binary values of the Golang constant, you know which is which.