From 39ca020010d8849de574a977639d17f0825af2ef Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Sun, 7 Aug 2022 11:42:13 +0800 Subject: [PATCH] fix: make check pass on release 3.8 (#14761) * fix: make check pass on release 3.8 * circleci GOPROXY=direct * update vendor * remove make test Co-authored-by: Qiu Jian --- .circleci/config.yml | 4 +--- cmd/dhcprelay/main.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- .../models/proxy_endpoints_remote_check_make.go | 2 +- pkg/hostman/storageman/storageutils/utils.go | 1 + pkg/hostman/storageman/storageutils/utils_windows.go | 1 + pkg/monitor/models/recordshield.go | 2 +- pkg/multicloud/jdcloud/shell/monitor.go | 2 +- pkg/util/dhcp/conn_linux.go | 3 ++- pkg/util/dhcp/conn_unsupported.go | 3 ++- pkg/util/fileutils2/writable_others.go | 1 + pkg/util/netutils2/netutils_others.go | 1 + pkg/util/printutils/termwidth_unix.go | 1 + pkg/util/printutils/termwidth_windows.go | 1 + pkg/util/procutils/cmdsetenv.go | 1 + pkg/util/procutils/cmdsetsid_others.go | 1 + pkg/util/procutils/zombie_others.go | 1 + vendor/modules.txt | 2 +- vendor/yunion.io/x/pkg/util/regutils/regutils.go | 6 ++++++ vendor/yunion.io/x/pkg/util/timeutils/timeutils.go | 11 +++++++++++ 21 files changed, 39 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a1e3b8b299..b4b708ef0a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: requires: - check docker: - - image: yunionio/centos-build:1.1-4 + - image: yunion/centos-build:go-1.18.3-0 environment: ONECLOUD_CI_BUILD: "1" @@ -16,14 +16,12 @@ jobs: #### /go/src/github.com/circleci/go-tool #### /go/src/bitbucket.org/circleci/go-tool working_directory: /root/go/src/yunion.io/x/onecloud - resource_class: large parallelism: 1 steps: - checkout - run: command: | make -j3 check - make test targets="$(circleci tests glob "cmd/*" | grep -v cmd/host-image | circleci tests split)" echo $targets | tr ' ' '\n' make $targets diff --git a/cmd/dhcprelay/main.go b/cmd/dhcprelay/main.go index f5fc4b8e35..010ab2ef40 100644 --- a/cmd/dhcprelay/main.go +++ b/cmd/dhcprelay/main.go @@ -78,7 +78,7 @@ func relayMain() error { time.Sleep(time.Hour) } - return nil + // return nil } func main() { diff --git a/go.mod b/go.mod index 0392df974a..8aa2314d91 100644 --- a/go.mod +++ b/go.mod @@ -149,7 +149,7 @@ require ( yunion.io/x/jsonutils v1.0.0 yunion.io/x/log v1.0.0 yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7 - yunion.io/x/pkg v1.0.0 + yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e yunion.io/x/sqlchemy v1.0.2 yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6 diff --git a/go.sum b/go.sum index 2158984049..dc4c1287d9 100644 --- a/go.sum +++ b/go.sum @@ -1081,8 +1081,8 @@ yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7/go.mod h1:0vLkNEhlmA64HViPB yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= -yunion.io/x/pkg v1.0.0 h1:G7Sng0fMZNKR5cavi5qQUxWjI1Tfbawk2vWnfII2rXg= -yunion.io/x/pkg v1.0.0/go.mod h1:nYOMflWG1wQC6301rGVglQva9bYbJxHThEJUxRAgMFc= +yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e h1:p/Cb7z6gyJbZKnGMeOPL3pTmnphB9GLCU+8qMsln7qA= +yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e/go.mod h1:nYOMflWG1wQC6301rGVglQva9bYbJxHThEJUxRAgMFc= yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo= yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo= yunion.io/x/sqlchemy v1.0.1/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI= diff --git a/pkg/cloudproxy/models/proxy_endpoints_remote_check_make.go b/pkg/cloudproxy/models/proxy_endpoints_remote_check_make.go index 99b46937a7..5ebeef5831 100644 --- a/pkg/cloudproxy/models/proxy_endpoints_remote_check_make.go +++ b/pkg/cloudproxy/models/proxy_endpoints_remote_check_make.go @@ -110,7 +110,7 @@ func (proxyendpoint *SProxyEndpoint) remoteCheckMake(ctx context.Context, userCr case <-time.After(2 * time.Second): } } - return httperrors.NewConflictError("remote sshd_config may have a problem with GatewayPorts") + // return httperrors.NewConflictError("remote sshd_config may have a problem with GatewayPorts") } func (proxyendpoint *SProxyEndpoint) remoteConfigure(ctx context.Context, userCred mcclient.TokenCredential) error { diff --git a/pkg/hostman/storageman/storageutils/utils.go b/pkg/hostman/storageman/storageutils/utils.go index 965546b323..3720245fcb 100644 --- a/pkg/hostman/storageman/storageutils/utils.go +++ b/pkg/hostman/storageman/storageutils/utils.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package storageutils diff --git a/pkg/hostman/storageman/storageutils/utils_windows.go b/pkg/hostman/storageman/storageutils/utils_windows.go index 2ff57b0d2a..d7e609a263 100644 --- a/pkg/hostman/storageman/storageutils/utils_windows.go +++ b/pkg/hostman/storageman/storageutils/utils_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package storageutils diff --git a/pkg/monitor/models/recordshield.go b/pkg/monitor/models/recordshield.go index 4459354744..e8b9917b5a 100644 --- a/pkg/monitor/models/recordshield.go +++ b/pkg/monitor/models/recordshield.go @@ -65,7 +65,7 @@ type SAlertRecordShield struct { db.SStatusStandaloneResourceBase SMonitorScopedResource - AlertId string `width:"36" charset:"ascii" nullable:"false" list:"user" create :"required" json:"alert_id"` + AlertId string `width:"36" charset:"ascii" nullable:"false" list:"user" create:"required" json:"alert_id"` ResId string `width:"36" nullable:"false" create:"optional" list:"user" update:"user" json:"res_id"` ResType string `width:"36" nullable:"false" create:"optional" list:"user" update:"user" json:"res_type"` diff --git a/pkg/multicloud/jdcloud/shell/monitor.go b/pkg/multicloud/jdcloud/shell/monitor.go index 296990c2d9..2c1ff483a7 100644 --- a/pkg/multicloud/jdcloud/shell/monitor.go +++ b/pkg/multicloud/jdcloud/shell/monitor.go @@ -22,7 +22,7 @@ import ( func init() { type DescribeMetricDataOptions struct { /* 监控项英文标识(id) */ - Metric string `help:"metric name"json:"metric"` + Metric string `help:"metric name" json:"metric"` TimeInterval string `help:"time interval" choices:"1h|6h|12h|1d|3d|7d|14d" json:"timeInterval"` ServiceCode string `help:"resource code" choices:"vm" json:"serviceCode"` ResourceId string `help:"resource id" json:"resourceId"` diff --git a/pkg/util/dhcp/conn_linux.go b/pkg/util/dhcp/conn_linux.go index d4e6028640..e3fd999277 100644 --- a/pkg/util/dhcp/conn_linux.go +++ b/pkg/util/dhcp/conn_linux.go @@ -27,7 +27,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//+build linux +//go:build linux +// +build linux package dhcp diff --git a/pkg/util/dhcp/conn_unsupported.go b/pkg/util/dhcp/conn_unsupported.go index 962f6e734f..2d85dbbe06 100644 --- a/pkg/util/dhcp/conn_unsupported.go +++ b/pkg/util/dhcp/conn_unsupported.go @@ -27,7 +27,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//+build !linux +//go:build !linux +// +build !linux package dhcp diff --git a/pkg/util/fileutils2/writable_others.go b/pkg/util/fileutils2/writable_others.go index af61eaaa6d..0d702c2124 100644 --- a/pkg/util/fileutils2/writable_others.go +++ b/pkg/util/fileutils2/writable_others.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package fileutils2 diff --git a/pkg/util/netutils2/netutils_others.go b/pkg/util/netutils2/netutils_others.go index fcf688dbde..5717879d77 100644 --- a/pkg/util/netutils2/netutils_others.go +++ b/pkg/util/netutils2/netutils_others.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !linux // +build !linux package netutils2 diff --git a/pkg/util/printutils/termwidth_unix.go b/pkg/util/printutils/termwidth_unix.go index 456d978f72..20e55e1342 100644 --- a/pkg/util/printutils/termwidth_unix.go +++ b/pkg/util/printutils/termwidth_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package printutils diff --git a/pkg/util/printutils/termwidth_windows.go b/pkg/util/printutils/termwidth_windows.go index b7b85b0ae3..fd55282781 100644 --- a/pkg/util/printutils/termwidth_windows.go +++ b/pkg/util/printutils/termwidth_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package printutils diff --git a/pkg/util/procutils/cmdsetenv.go b/pkg/util/procutils/cmdsetenv.go index b947aac701..58a3d0a79d 100644 --- a/pkg/util/procutils/cmdsetenv.go +++ b/pkg/util/procutils/cmdsetenv.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package procutils diff --git a/pkg/util/procutils/cmdsetsid_others.go b/pkg/util/procutils/cmdsetsid_others.go index 32197eb6ce..ebcdaee9e6 100644 --- a/pkg/util/procutils/cmdsetsid_others.go +++ b/pkg/util/procutils/cmdsetsid_others.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package procutils diff --git a/pkg/util/procutils/zombie_others.go b/pkg/util/procutils/zombie_others.go index 1fd649d508..d555fedec8 100644 --- a/pkg/util/procutils/zombie_others.go +++ b/pkg/util/procutils/zombie_others.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package procutils diff --git a/vendor/modules.txt b/vendor/modules.txt index 5a2852b548..dd1a1541ce 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1134,7 +1134,7 @@ yunion.io/x/log/hooks yunion.io/x/ovsdb/cli_util yunion.io/x/ovsdb/schema/ovn_nb yunion.io/x/ovsdb/types -# yunion.io/x/pkg v1.0.0 +# yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e yunion.io/x/pkg/errors yunion.io/x/pkg/gotypes yunion.io/x/pkg/prettytable diff --git a/vendor/yunion.io/x/pkg/util/regutils/regutils.go b/vendor/yunion.io/x/pkg/util/regutils/regutils.go index f7c88459bf..eb0011411d 100644 --- a/vendor/yunion.io/x/pkg/util/regutils/regutils.go +++ b/vendor/yunion.io/x/pkg/util/regutils/regutils.go @@ -45,6 +45,7 @@ var FULLISO_TIME_REG2 *regexp.Regexp var ZSTACK_TIME_REG *regexp.Regexp var COMPACT_TIME_REG *regexp.Regexp var MYSQL_TIME_REG *regexp.Regexp +var CLICKHOUSE_TIME_REG *regexp.Regexp var NORMAL_TIME_REG *regexp.Regexp var FULLNORMAL_TIME_REG *regexp.Regexp var RFC2882_TIME_REG *regexp.Regexp @@ -79,6 +80,7 @@ func init() { COMPACT_TIME_REG = regexp.MustCompile(`^\d{14}$`) ZSTACK_TIME_REG = regexp.MustCompile(`^\w+ \d{1,2}, \d{4} \d{1,2}:\d{1,2}:\d{1,2} (AM|PM)$`) //ZStack time format "Apr 1, 2019 3:23:17 PM" MYSQL_TIME_REG = regexp.MustCompile(`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$`) + CLICKHOUSE_TIME_REG = regexp.MustCompile(`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [+-]\d{4} [A-Z]{3}$`) NORMAL_TIME_REG = regexp.MustCompile(`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$`) FULLNORMAL_TIME_REG = regexp.MustCompile(`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}$`) RFC2882_TIME_REG = regexp.MustCompile(`[A-Z][a-z]{2}, [0-9]{1,2} [A-Z][a-z]{2} [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3}`) @@ -234,6 +236,10 @@ func MatchMySQLTime(str string) bool { return MYSQL_TIME_REG.MatchString(str) } +func MatchClickhouseTime(str string) bool { + return CLICKHOUSE_TIME_REG.MatchString(str) +} + func MatchNormalTime(str string) bool { return NORMAL_TIME_REG.MatchString(str) } diff --git a/vendor/yunion.io/x/pkg/util/timeutils/timeutils.go b/vendor/yunion.io/x/pkg/util/timeutils/timeutils.go index d0ef7d1ad5..2550622718 100644 --- a/vendor/yunion.io/x/pkg/util/timeutils/timeutils.go +++ b/vendor/yunion.io/x/pkg/util/timeutils/timeutils.go @@ -49,6 +49,7 @@ const ( FullIsoTimeFormat = "2006-01-02T15:04:05.000000Z07:00" FullIsoNanoTimeFormat = "2006-01-02T15:04:05.000000000Z07:00" MysqlTimeFormat = "2006-01-02 15:04:05" + ClickhouseTimeFormat = "2006-01-02 15:04:05 +0000 UTC" NormalTimeFormat = "2006-01-02T15:04:05" FullNormalTimeFormat = "2006-01-02T15:04:05.000000" CompactTimeFormat = "20060102150405" @@ -86,6 +87,10 @@ func MysqlTime(now time.Time) string { return Utcify(now).Format(MysqlTimeFormat) } +func ClickhouseTime(now time.Time) string { + return Utcify(now).Format(ClickhouseTimeFormat) +} + func CompactTime(now time.Time) string { return Utcify(now).Format(CompactTimeFormat) } @@ -168,6 +173,10 @@ func ParseMysqlTime(str string) (time.Time, error) { return time.Parse(MysqlTimeFormat, str) } +func ParseClickhouseTime(str string) (time.Time, error) { + return time.Parse(ClickhouseTimeFormat, str) +} + func ParseNormalTime(str string) (time.Time, error) { return time.Parse(NormalTimeFormat, str) } @@ -216,6 +225,8 @@ func ParseTimeStr(str string) (time.Time, error) { return ParseIsoNoSecondTime2(str) } else if regutils.MatchMySQLTime(str) { return ParseMysqlTime(str) + } else if regutils.MatchClickhouseTime(str) { + return ParseClickhouseTime(str) } else if regutils.MatchNormalTime(str) { return ParseNormalTime(str) } else if regutils.MatchFullNormalTime(str) {