From 271bd9083d32f017d3ac87c48e483d01db40d10f Mon Sep 17 00:00:00 2001 From: dustoair <107600816+dustoair@users.noreply.github.com> Date: Sun, 19 Feb 2023 11:22:24 +0800 Subject: [PATCH] token_response nil issue panic: interface conversion: interface {} is nil, not string goroutine 1 [running]: remoteMonitor/thirdpart.get_token({0x2b03ab?, 0x8?}, {0x2b2511?, 0x3?}) /root/remoteMonitor/thirdpart/WeChat.go:53 +0x1c8 remoteMonitor/thirdpart.SendWechat({0x40000d0000, 0x91}) /root/remoteMonitor/thirdpart/WeChat.go:101 +0x5c main.main() /root/remoteMonitor/main.go:25 +0x19c --- README.MD | 16 +++++++++++++++- thirdpart/WeChat.go | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 92f0927..d19c7ef 100644 --- a/README.MD +++ b/README.MD @@ -15,9 +15,23 @@ rm -rf /usr/bin/rtm mv rtm /usr/bin/ rtm ``` +## build amd64 oracle +```bash +cd /root +rm -rf remoteMonitor +git clone https://git.sre.ink/go/remoteMonitor.git +cd remoteMonitor +go get github.com/shirou/gopsutil/v3/cpu@v3.21.12 +go get github.com/shirou/gopsutil/v3/disk@v3.21.12 +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -v -a -o rtm main.go +chmod +x rtm +rm -rf /usr/bin/rtm +mv rtm /usr/bin/ +rtm +``` -## build +## build amd64 cn ```bash cd /root rm -rf remoteMonitor diff --git a/thirdpart/WeChat.go b/thirdpart/WeChat.go index 9d273a2..8700daf 100644 --- a/thirdpart/WeChat.go +++ b/thirdpart/WeChat.go @@ -50,6 +50,9 @@ func get_token(corpid, app_secret string) string { log.Println(err) } token_response := praser_json(string(resp_data)) + if token_response == nil { + return "" + } return token_response["access_token"].(string) }