我想在appdata
路径中存储一些文件,但是我不知道如何在golang中获取它。
答案 0 :(得分:5)
os包中已有相关函数,参考here:
package main
func main() {
os.UserHomeDir() // C:\Users\YourUser
os.UserCacheDir() // C:\Users\YourUser\AppData\Local
os.UserConfigDir() // C:\Users\YourUser\AppData\Roaming
}
答案 1 :(得分:1)
它位于用户主文件夹中,因此您可以获取用户文件夹并追加AppData:
node_modules/@types/node/globals.d.ts(926,15): error TS2430: Interface 'Global' incorrectly extends interface 'MochaGlobals'.
Types of property 'describe' are incompatible.
Type 'Describe' is not assignable to type 'SuiteFunction'.
Types of property 'only' are incompatible.
Type 'DescribeBase' is not assignable to type 'ExclusiveSuiteFunction'.
Type 'void' is not assignable to type 'Suite'.