Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let errcheck pass in ci #1919

Closed
zhouqiang-cl opened this issue Nov 10, 2019 · 1 comment · Fixed by #8346
Closed

let errcheck pass in ci #1919

zhouqiang-cl opened this issue Nov 10, 2019 · 1 comment · Fixed by #8346
Labels
difficulty/easy Easy task. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. type/ci The issue is related to CI.

Comments

@zhouqiang-cl
Copy link
Contributor

zhouqiang-cl commented Nov 10, 2019

PCP Issue

  • difficult: easy
  • score: 50
  • min score required: 0
  • Recommended Skills: Go

Description

we disable the errorcheck in #1956, if you run GO111MODULE=on errcheck ./... will got:

client/client.go:278:11:	cc.Close()
client/client_test.go:114:17:	s.srv.PutStore(context.Background(), &pdpb.PutStoreRequest{Header: newHeader(s.srv), Store: store})
client/client_test.go:295:46:	s.srv.GetRaftCluster().HandleRegionHeartbeat(region3)
cmd/pd-server/main.go:70:16:	defer log.Sync()
cmd/pd-server/main.go:133:10:	log.Sync()
pkg/apiutil/apiutil.go:120:10:	rd.JSON(w, http.StatusInternalServerError, "nil error")
pkg/apiutil/apiutil.go:125:10:	rd.JSON(w, errCode.Code().HTTPCode(), errcode.NewJSONFormat(errCode))
pkg/apiutil/apiutil.go:127:10:	rd.JSON(w, http.StatusInternalServerError, err.Error())
pkg/btree/btree.go:746:13:	fmt.Fprintf(w, "%sNODE:%v, %v\n", strings.Repeat("  ", level), n.items, n.indices)
pkg/etcdutil/etcdutil_test.go:64:14:	os.RemoveAll(cfg.Dir)
pkg/testutil/testutil.go:65:14:	os.RemoveAll(dataDir)
server/api/admin.go:44:12:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/admin.go:48:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/admin.go:59:12:	h.rd.JSON(w, http.StatusBadRequest, "invalid tso value")
server/api/admin.go:64:12:	h.rd.JSON(w, http.StatusBadRequest, "invalid tso value")
server/api/admin.go:70:13:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/admin.go:72:13:	h.rd.JSON(w, http.StatusForbidden, err.Error())
server/api/admin.go:75:11:	h.rd.JSON(w, http.StatusOK, "success")
server/api/admin_test.go:77:16:	res.Body.Close()
server/api/cluster.go:36:11:	h.rd.JSON(w, http.StatusOK, h.svr.GetCluster())
server/api/cluster.go:42:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/cluster.go:45:11:	h.rd.JSON(w, http.StatusOK, status)
server/api/cluster_test.go:75:28:	s.svr.SetReplicationConfig(config.ReplicationConfig{MaxReplicas: 1})
server/api/config.go:43:11:	h.rd.JSON(w, http.StatusOK, h.svr.GetConfig())
server/api/config.go:49:14:	r.Body.Close()
server/api/config.go:51:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/config.go:56:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/config.go:61:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/config.go:66:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/config.go:70:12:	h.rd.JSON(w, http.StatusBadRequest, "config item not found")
server/api/config.go:73:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/config.go:113:11:	h.rd.JSON(w, http.StatusOK, h.svr.GetScheduleConfig())
server/api/config.go:123:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/config.go:126:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/config.go:130:11:	h.rd.JSON(w, http.StatusOK, h.svr.GetReplicationConfig())
server/api/config.go:140:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/config.go:143:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/config.go:147:11:	h.rd.JSON(w, http.StatusOK, h.svr.GetLabelProperty())
server/api/config.go:165:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/config.go:168:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/config.go:172:11:	h.rd.JSON(w, http.StatusOK, h.svr.GetClusterVersion())
server/api/config.go:190:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/diagnose.go:166:12:	d.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/diagnose.go:169:11:	d.rd.JSON(w, http.StatusOK, rdd)
server/api/diagnose_test.go:55:23:	defer resp.Body.Close()
server/api/health.go:47:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/health.go:64:11:	h.rd.JSON(w, http.StatusOK, healths)
server/api/health_test.go:67:23:	defer resp.Body.Close()
server/api/hot_status.go:44:11:	h.rd.JSON(w, http.StatusOK, h.Handler.GetHotWriteRegions())
server/api/hot_status.go:48:11:	h.rd.JSON(w, http.StatusOK, h.Handler.GetHotReadRegions())
server/api/hot_status.go:63:11:	h.rd.JSON(w, http.StatusOK, stats)
server/api/label.go:53:11:	h.rd.JSON(w, http.StatusOK, labels)
server/api/label.go:62:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/label.go:76:13:	h.rd.JSON(w, http.StatusInternalServerError, server.ErrStoreNotFound(storeID))
server/api/label.go:85:11:	h.rd.JSON(w, http.StatusOK, storesInfo)
server/api/log.go:42:14:	r.Body.Close()
server/api/log.go:44:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/log.go:49:12:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/log.go:56:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/member.go:48:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:51:11:	h.rd.JSON(w, http.StatusOK, members)
server/api/member.go:84:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:94:12:	h.rd.JSON(w, http.StatusNotFound, fmt.Sprintf("not found, pd: %s", name))
server/api/member.go:101:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:108:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:111:11:	h.rd.JSON(w, http.StatusOK, fmt.Sprintf("removed, pd: %s", name))
server/api/member.go:118:12:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/member.go:125:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:132:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:135:11:	h.rd.JSON(w, http.StatusOK, fmt.Sprintf("removed, pd: %v", id))
server/api/member.go:141:12:	h.rd.JSON(w, http.StatusInternalServerError, membersErr.Error())
server/api/member.go:154:12:	h.rd.JSON(w, http.StatusNotFound, fmt.Sprintf("not found, pd: %s", name))
server/api/member.go:167:14:	h.rd.JSON(w, http.StatusBadRequest, "bad format leader priority")
server/api/member.go:172:14:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:177:11:	h.rd.JSON(w, http.StatusOK, "success")
server/api/member.go:193:11:	h.rd.JSON(w, http.StatusOK, h.svr.GetLeader())
server/api/member.go:199:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:203:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/member.go:209:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/member.go:213:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/member_test.go:57:16:	json.Unmarshal(body, &got)
server/api/member_test.go:80:18:	resp.Body.Close()
server/api/member_test.go:90:23:	defer resp.Body.Close()
server/api/middleware.go:39:13:	m.rd.JSON(w, http.StatusInternalServerError, server.ErrNotBootstrapped.Error())
server/api/operator.go:44:11:	h.r.JSON(w, http.StatusBadRequest, err.Error())
server/api/operator.go:50:11:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:54:10:	h.r.JSON(w, http.StatusOK, op)
server/api/operator.go:68:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:84:13:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:91:10:	h.r.JSON(w, http.StatusOK, results)
server/api/operator.go:102:11:	h.r.JSON(w, http.StatusBadRequest, "missing operator name")
server/api/operator.go:110:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:115:12:	h.r.JSON(w, http.StatusBadRequest, "missing store id to transfer leader to")
server/api/operator.go:119:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:125:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:130:12:	h.r.JSON(w, http.StatusBadRequest, "invalid store ids to transfer region to")
server/api/operator.go:134:12:	h.r.JSON(w, http.StatusBadRequest, "missing store ids to transfer region to")
server/api/operator.go:138:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:144:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:149:12:	h.r.JSON(w, http.StatusBadRequest, "invalid store id to transfer peer from")
server/api/operator.go:154:12:	h.r.JSON(w, http.StatusBadRequest, "invalid store id to transfer peer to")
server/api/operator.go:158:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:164:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:169:12:	h.r.JSON(w, http.StatusBadRequest, "invalid store id to transfer peer to")
server/api/operator.go:173:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:179:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:184:12:	h.r.JSON(w, http.StatusBadRequest, "invalid store id to transfer peer to")
server/api/operator.go:188:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:194:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:199:12:	h.r.JSON(w, http.StatusBadRequest, "invalid store id to transfer peer to")
server/api/operator.go:203:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:209:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:214:12:	h.r.JSON(w, http.StatusBadRequest, "invalid target region id to merge to")
server/api/operator.go:218:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:224:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:229:12:	h.r.JSON(w, http.StatusBadRequest, "missing split policy")
server/api/operator.go:237:14:	h.r.JSON(w, http.StatusBadRequest, "bad format keys")
server/api/operator.go:244:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:250:12:	h.r.JSON(w, http.StatusBadRequest, "missing region id")
server/api/operator.go:254:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:258:11:	h.r.JSON(w, http.StatusBadRequest, "unknown operator")
server/api/operator.go:262:10:	h.r.JSON(w, http.StatusOK, nil)
server/api/operator.go:270:11:	h.r.JSON(w, http.StatusBadRequest, err.Error())
server/api/operator.go:275:11:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/operator.go:279:10:	h.r.JSON(w, http.StatusOK, nil)
server/api/operator_test.go:120:35:	s.svr.GetHandler().RemoveOperator(10)
server/api/operator_test.go:121:35:	s.svr.GetHandler().RemoveOperator(20)
server/api/operator_test.go:124:35:	s.svr.GetHandler().RemoveOperator(10)
server/api/operator_test.go:125:35:	s.svr.GetHandler().RemoveOperator(20)
server/api/operator_test.go:158:22:	defer res.Body.Close()
server/api/redirector.go:126:18:	resp.Body.Close()
server/api/redirector_test.go:70:23:	defer resp.Body.Close()
server/api/redirector_test.go:93:23:	defer resp.Body.Close()
server/api/redirector_test.go:103:24:	defer resp1.Body.Close()
server/api/redirector_test.go:112:23:	defer resp.Body.Close()
server/api/region.go:96:12:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/region.go:101:11:	h.rd.JSON(w, http.StatusOK, NewRegionInfo(regionInfo))
server/api/region.go:109:11:	h.rd.JSON(w, http.StatusOK, NewRegionInfo(regionInfo))
server/api/region.go:139:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:151:13:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/region.go:160:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:166:11:	h.rd.JSON(w, http.StatusOK, &RegionsInfo{Count: count})
server/api/region.go:175:12:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/region.go:180:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:187:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/region.go:191:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:198:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/region.go:202:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:209:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/region.go:213:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:220:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/region.go:224:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:231:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/region.go:235:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:242:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/region.go:246:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:255:12:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/region.go:260:12:	h.rd.JSON(w, http.StatusNotFound, server.ErrRegionNotFound(uint64(id)).Error())
server/api/region.go:266:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/region.go:307:13:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/region.go:316:11:	h.rd.JSON(w, http.StatusOK, regionsInfo)
server/api/rule.go:49:12:	h.rd.JSON(w, http.StatusPreconditionFailed, errPlacementDisabled.Error())
server/api/rule.go:53:11:	h.rd.JSON(w, http.StatusOK, rules)
server/api/rule.go:59:12:	h.rd.JSON(w, http.StatusPreconditionFailed, errPlacementDisabled.Error())
server/api/rule.go:64:11:	h.rd.JSON(w, http.StatusOK, rules)
server/api/rule.go:70:12:	h.rd.JSON(w, http.StatusPreconditionFailed, errPlacementDisabled.Error())
server/api/rule.go:76:12:	h.rd.JSON(w, http.StatusBadRequest, "invalid region id")
server/api/rule.go:81:12:	h.rd.JSON(w, http.StatusNotFound, server.ErrRegionNotFound(regionID).Error())
server/api/rule.go:85:11:	h.rd.JSON(w, http.StatusOK, rules)
server/api/rule.go:91:12:	h.rd.JSON(w, http.StatusPreconditionFailed, errPlacementDisabled.Error())
server/api/rule.go:97:12:	h.rd.JSON(w, http.StatusBadRequest, "key should be in hex format")
server/api/rule.go:101:11:	h.rd.JSON(w, http.StatusOK, rules)
server/api/rule.go:107:12:	h.rd.JSON(w, http.StatusPreconditionFailed, errPlacementDisabled.Error())
server/api/rule.go:113:12:	h.rd.JSON(w, http.StatusNotFound, nil)
server/api/rule.go:116:11:	h.rd.JSON(w, http.StatusOK, rule)
server/api/rule.go:122:12:	h.rd.JSON(w, http.StatusPreconditionFailed, errPlacementDisabled.Error())
server/api/rule.go:130:12:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/rule.go:134:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/rule.go:137:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/rule.go:173:12:	h.rd.JSON(w, http.StatusPreconditionFailed, errPlacementDisabled.Error())
server/api/rule.go:178:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/rule.go:181:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/scheduler.go:40:11:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:43:10:	h.r.JSON(w, http.StatusOK, schedulers)
server/api/scheduler.go:54:11:	h.r.JSON(w, http.StatusBadRequest, "missing scheduler name")
server/api/scheduler.go:61:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:66:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:71:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:76:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:86:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:91:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:96:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:100:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:116:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:122:12:	h.r.JSON(w, http.StatusBadRequest, "missing store id")
server/api/scheduler.go:126:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:132:12:	h.r.JSON(w, http.StatusBadRequest, "missing store id")
server/api/scheduler.go:136:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:141:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:146:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:151:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:161:12:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:165:11:	h.r.JSON(w, http.StatusBadRequest, "unknown scheduler")
server/api/scheduler.go:169:10:	h.r.JSON(w, http.StatusOK, nil)
server/api/scheduler.go:176:11:	h.r.JSON(w, http.StatusInternalServerError, err.Error())
server/api/scheduler.go:180:10:	h.r.JSON(w, http.StatusOK, nil)
server/api/scheduler.go:202:11:	h.rd.JSON(w, http.StatusNotAcceptable, errNoImplement)
server/api/stats.go:39:11:	h.rd.JSON(w, http.StatusOK, stats)
server/api/status.go:44:11:	h.rd.JSON(w, http.StatusOK, version)
server/api/status_test.go:47:18:	resp.Body.Close()
server/api/store.go:150:12:	h.rd.JSON(w, http.StatusInternalServerError, server.ErrStoreNotFound(storeID))
server/api/store.go:155:11:	h.rd.JSON(w, http.StatusOK, storeInfo)
server/api/store.go:180:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/store.go:195:12:	h.rd.JSON(w, http.StatusBadRequest, "invalid state")
server/api/store.go:201:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/store.go:205:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/store.go:236:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/store.go:240:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/store.go:259:12:	h.rd.JSON(w, http.StatusBadRequest, "leader weight unset")
server/api/store.go:264:12:	h.rd.JSON(w, http.StatusBadRequest, "region weight unset")
server/api/store.go:269:12:	h.rd.JSON(w, http.StatusBadRequest, "badformat leader weight")
server/api/store.go:274:12:	h.rd.JSON(w, http.StatusBadRequest, "badformat region weight")
server/api/store.go:279:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/store.go:283:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/store.go:301:12:	h.rd.JSON(w, http.StatusBadRequest, "rate unset")
server/api/store.go:306:12:	h.rd.JSON(w, http.StatusBadRequest, "badformat rate")
server/api/store.go:311:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/store.go:315:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/store.go:338:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/store.go:349:12:	h.rd.JSON(w, http.StatusBadRequest, "rate unset")
server/api/store.go:354:12:	h.rd.JSON(w, http.StatusBadRequest, "badformat rate")
server/api/store.go:359:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/store.go:363:11:	h.rd.JSON(w, http.StatusOK, nil)
server/api/store.go:369:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/store.go:379:11:	h.rd.JSON(w, http.StatusOK, ret)
server/api/store.go:391:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/store.go:400:13:	h.rd.JSON(w, http.StatusInternalServerError, server.ErrStoreNotFound(storeID))
server/api/store.go:409:11:	h.rd.JSON(w, http.StatusOK, StoresInfo)
server/api/store_test.go:139:22:	s.svr.StoreHeartbeat(
server/api/trend.go:83:13:	h.rd.JSON(w, http.StatusBadRequest, err.Error())
server/api/trend.go:91:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/trend.go:97:12:	h.rd.JSON(w, http.StatusInternalServerError, err.Error())
server/api/trend.go:105:11:	h.rd.JSON(w, http.StatusOK, trend)
server/api/util.go:68:23:	defer resp.Body.Close()
server/api/util.go:91:23:	defer resp.Body.Close()
server/api/util.go:116:16:	res.Body.Close()
server/api/version.go:27:11:	h.rd.JSON(w, http.StatusOK, version)
server/api/version_test.go:49:24:	defer resp.Body.Close()
server/api/version_test.go:73:13:	temp.Close()
server/api/version_test.go:75:12:	os.Remove(fname)
server/cluster_test.go:495:25:	s.svr.SetClusterVersion("2.0.0")
server/cluster_test.go:507:25:	s.svr.SetClusterVersion("1.0.0")
server/cluster_test.go:580:17:	stream.Recv()
server/cluster_worker_test.go:104:25:	s.svr.SetClusterVersion("3.1.0")
server/coordinator_test.go:942:14:	tc.putRegion(region)
server/coordinator_test.go:984:14:	tc.putRegion(region)
server/coordinator_test.go:986:14:	tc.putRegion(region)
server/join/join.go:124:20:	defer client.Close()
server/join/join.go:216:17:	defer dir.Close()
server/kv/etcd_kv_test.go:117:14:	os.RemoveAll(cfg.Dir)
server/member/leader.go:357:21:	defer watcher.Close()
server/member/lease.go:72:16:	l.lease.Revoke(ctx, l.ID)
server/schedule/placement/rule_manager_test.go:78:20:	s.manager.SetRule(r)
server/schedule/placement/rule_manager_test.go:88:22:	s.manager.DeleteRule("pd", "default")
server/schedule/placement/rule_manager_test.go:97:20:	s.manager.SetRule(r)
server/schedulers/balance_leader.go:56:10:	decoder(conf)
server/schedulers/balance_region.go:51:10:	decoder(conf)
server/schedulers/balance_test.go:1218:29:	sche.config.BuildWithArgs(args)
server/schedulers/base_scheduler.go:67:13:	fmt.Fprintf(w, "not implements")
server/schedulers/evict_leader.go:59:10:	decoder(conf)
server/schedulers/grant_leader.go:56:10:	decoder(conf)
server/schedulers/label.go:49:10:	decoder(conf)
server/schedulers/random_merge.go:48:10:	decoder(conf)
server/schedulers/scatter_range.go:56:9:	decode(config)
server/schedulers/scatter_range.go:106:33:	conf.storage.SaveScheduleConfig(name, data)
server/schedulers/scatter_range.go:231:19:	handler.rd.JSON(w, http.StatusInternalServerError, errors.New("Cannot change the range name, please delete this schedule"))
server/schedulers/scatter_range.go:252:30:	handler.config.BuildWithArgs(args)
server/schedulers/scatter_range.go:255:18:	handler.rd.JSON(w, http.StatusInternalServerError, err)
server/schedulers/scatter_range.go:257:17:	handler.rd.JSON(w, http.StatusOK, nil)
server/schedulers/scatter_range.go:262:17:	handler.rd.JSON(w, http.StatusOK, conf)
server/schedulers/shuffle_hot_region.go:55:10:	decoder(conf)
server/schedulers/shuffle_leader.go:47:10:	decoder(conf)
server/schedulers/shuffle_region.go:49:10:	decoder(conf)
server/server.go:269:17:	s.client.Close()
server/server.go:717:20:	resp.Body.Close()
server/server.go:773:19:	defer lease.Close()
tests/pdctl/config/config_test.go:84:12:	cfg.Adjust(nil)
tests/pdctl/helper.go:146:12:	temp.Close()
tests/server/member/member_test.go:99:24:	defer res.Body.Close()
tests/server/member/member_test.go:125:22:	defer res.Body.Close()
tests/server/member/member_test.go:132:16:	json.Unmarshal(buf, &data)
tests/server/member/member_test.go:180:17:	res.Body.Close()
tests/server/member/member_test.go:252:19:	s.ResignLeader()
tests/server/member/member_test.go:255:21:	s.MoveEtcdLeader(old, s.GetServerID())
tests/server/tso/tso_test.go:77:27:	defer tsoClient.CloseSend()
tests/server/tso/tso_test.go:136:27:	defer tsoClient.CloseSend()
tests/server/tso/tso_test.go:169:19:	failpoint.Disable("github.com/pingcap/pd/server/tso/fallBackSync")
tests/server/tso/tso_test.go:170:19:	failpoint.Disable("github.com/pingcap/pd/server/tso/fallBackUpdate")
tests/server/tso/tso_test.go:192:27:	defer tsoClient.CloseSend()
tests/server/watch/leader_watch_test.go:83:19:	failpoint.Disable("github.com/pingcap/pd/server/delayWatcher")
tools/pd-analysis/analysis/parse_log.go:84:16:	defer fi.Close()
tools/pd-analysis/analysis/transfer_counter.go:240:16:	defer fd.Close()
tools/pd-ctl/main.go:113:15:	defer l.Close()
tools/pd-ctl/pdctl/command/global.go:110:23:	defer resp.Body.Close()
tools/pd-ctl/pdctl/command/global.go:192:21:	defer r.Body.Close()
tools/pd-ctl/pdctl/command/region_command.go:361:14:	fmt.Sscanf(string(r.Next(2)), "%02x", &c)
tools/pd-ctl/pdctl/command/region_command.go:498:20:	defer stdin.Close()
tools/pd-ctl/pdctl/command/store_command.go:196:12:	cmd.Usage()
tools/pd-ctl/pdctl/command/store_command.go:214:12:	cmd.Usage()
tools/pd-ctl/pdctl/command/store_command.go:265:12:	cmd.Usage()
tools/pd-ctl/pdctl/command/store_command.go:278:12:	cmd.Usage()
tools/pd-ctl/pdctl/command/store_command.go:304:12:	cmd.Usage()
tools/pd-ctl/pdctl/command/store_command.go:362:12:	cmd.Usage()
tools/pd-ctl/pdctl/ctl.go:69:20:	rootCmd.ParseFlags(args)
tools/pd-simulator/main.go:132:14:	os.RemoveAll(cfg.DataDir)
tools/regions-dump/main.go:62:15:	defer f.Close()
tools/regions-dump/main.go:97:15:	defer w.Flush()
tools/regions-dump/main.go:118:16:	fmt.Fprintln(w, core.RegionToHexMeta(region).Region)

fix it and enable it in ci.

@zhouqiang-cl zhouqiang-cl added the type/bug The issue is confirmed as a bug. label Nov 10, 2019
@zhouqiang-cl zhouqiang-cl changed the title errcheck found many outputs 318 unchecked errors in errcheck Nov 10, 2019
@nolouch nolouch changed the title 318 unchecked errors in errcheck PCP: let errcheck pass in ci Nov 23, 2019
@sre-bot sre-bot added the PCP-S1 label Nov 23, 2019
@nolouch nolouch added difficulty/easy Easy task. and removed type/bug The issue is confirmed as a bug. labels Nov 23, 2019
@nolouch nolouch removed their assignment Nov 23, 2019
@you06 you06 changed the title PCP: let errcheck pass in ci let errcheck pass in ci Feb 29, 2020
@rleungx rleungx added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Oct 19, 2021
@ti-chi-bot ti-chi-bot added the needs-type Indicates an issue requires a type label. label Dec 1, 2021
@rleungx rleungx added the type/ci The issue is related to CI. label Mar 11, 2022
@ti-chi-bot ti-chi-bot removed the needs-type Indicates an issue requires a type label. label Mar 11, 2022
@okJiang
Copy link
Member

okJiang commented Jun 14, 2024

after #8277, we can fix errcheck module by module

Tools

  • pd-analysis
  • pd-api-bench
  • pd-backup
  • pd-ctl
  • pd-heartbeat-bench
  • pd-recover
  • pd-simulator
  • pd-tso-bench
  • pd-ut
  • regions-dump
  • stores-dump

Core

  • pkg/schedule/labeler/labeler.go
  • pkg/mcs/tso/server/config.go
  • pkg/tso/admin.go
  • pkg/mcs/tso/server/grpc_service.go
  • pkg/mcs/scheduling/server/grpc_service.go
  • pkg/mcs/resourcemanager/server/.*.go
  • plugin/scheduler_example/evict_leader.go
  • server/api/.*.go
  • pkg/replication/replication_mode.go
  • pkg/mcs/scheduling/server/server.go
  • pkg/storage/endpoint/gc_safe_point.go
  • server/.*.go
  • pkg/schedule/schedulers/.*.go
  • pkg/schedule/placement/rule.go
  • pkg/mcs/utils/util.go
  • pkg/keyspace/tso_keyspace_group.go
  • pkg/tso/allocator_manager.go
  • pkg/core/store_stats.go
  • pkg/autoscaling/handler.go
  • pkg/keyspace/keyspace.go
  • pkg/storage/hot_region_storage.go
  • pkg/syncer/server.go

ti-chi-bot bot added a commit that referenced this issue Jun 14, 2024
ref #1919

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot added a commit that referenced this issue Jun 14, 2024
ref #1919

Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot pushed a commit that referenced this issue Jun 19, 2024
ref #1919

Signed-off-by: okJiang <819421878@qq.com>
ti-chi-bot bot added a commit that referenced this issue Jun 25, 2024
ref #1919

Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot added a commit that referenced this issue Jun 27, 2024
ref #1919

Signed-off-by: okJiang <819421878@qq.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/easy Easy task. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. type/ci The issue is related to CI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants