1 在D盘新建一个文件夹:gosrc
2git clone https://github.com/google/battery-historian.git
3 cd 到D:\gosrc\battery-historian>go mod init gosrc初始化模块名为gosrc,你可以自定义自己的名字
4// 执行该命令,更换为国内代理地址
go env -w GOPROXY=https://goproxy.cn,direct
5在D:\gosrc\battery-historian路径下执行go run setup.go
6会提示:
D:\gosrc\battery-historian>go run setup.go
setup.go:30:2: no required module provides package github.com/google/battery-historian/bugreportutils; to add it:
go get github.com/google/battery-historian/bugreportutils
setup.go:31:2: no required module provides package github.com/google/battery-historian/historianutils; to add it:
go get github.com/google/battery-historian/historianutils
7解决方法:
go get -d -u github.com/google/battery-historian/bugreportutils
go get -d -u github.com/google/battery-historian/historianutils
8继续执行,会报错
例如:depswriter.py No such file or directory 错误(更新golang再试)
例如:js解析错误,如:"Parse error. unknown @suppress parameter: strictMissingProperties"
解决方法:
go run setup.go (this fails)
cd third_party/closure-library/
git reset --hard v20170409
再cd到D:\gosrc\battery-historian路径下重新执行go run setup.go (this passes)
如:D:\gosrc\battery-historian>cd third_party/closure-library/
D:\gosrc\battery-historian\third_party\closure-library>git reset --hard v20170409
HEAD is now at 80b531334 Update doc for goog.crypt.Hash.prototype.update.
D:\gosrc\battery-historian\third_party\closure-library>
重新执行go run setup.go,如:
D:\gosrc\battery-historian>go run setup.go
Generating JS runfiles...
Generating optimized JS runfiles...
9:go run cmd/battery-historian/battery-historian.go
10:chrome浏览器输入:http://localhost:9999/即可,浏览添加zip文件