From d57ee8daaffc22b17ff14b6c620d164ea18ae9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Mon, 12 Sep 2022 16:48:11 +0800 Subject: [PATCH] - add vendor --- vendor/go.dtapp.net/golog/.gitignore | 1 - vendor/go.dtapp.net/golog/api.go | 9 +++ vendor/go.dtapp.net/golog/api_gorm.go | 45 ++++++----- vendor/go.dtapp.net/golog/api_mongo.go | 20 ++++- vendor/go.dtapp.net/golog/const.go | 2 +- vendor/go.dtapp.net/golog/gin.go | 9 +++ vendor/go.dtapp.net/golog/gin_gorm.go | 7 ++ vendor/go.dtapp.net/golog/gin_mongo.go | 19 +++++ vendor/go.dtapp.net/gorequest/.gitignore | 1 - vendor/go.dtapp.net/gorequest/url.go | 78 +++++++++++++++++++ vendor/golang.org/x/sys/unix/syscall.go | 9 +-- .../x/sys/unix/syscall_darwin.1_13.go | 12 +-- vendor/golang.org/x/sys/unix/syscall_unix.go | 8 +- vendor/golang.org/x/sys/unix/sysvshm_unix.go | 13 +--- vendor/modules.txt | 8 +- 15 files changed, 177 insertions(+), 64 deletions(-) create mode 100644 vendor/go.dtapp.net/gorequest/url.go diff --git a/vendor/go.dtapp.net/golog/.gitignore b/vendor/go.dtapp.net/golog/.gitignore index 5c75b7d..c1823b5 100644 --- a/vendor/go.dtapp.net/golog/.gitignore +++ b/vendor/go.dtapp.net/golog/.gitignore @@ -6,4 +6,3 @@ *.log gomod.sh *_test.go -/vendor/ diff --git a/vendor/go.dtapp.net/golog/api.go b/vendor/go.dtapp.net/golog/api.go index d635824..4a23013 100644 --- a/vendor/go.dtapp.net/golog/api.go +++ b/vendor/go.dtapp.net/golog/api.go @@ -34,6 +34,11 @@ type ApiClient struct { gorm bool // 日志开关 mongo bool // 日志开关 } + config struct { + os string // 系统类型 + arch string // 系统架构 + maxProCs int // CPU核数 + } } // client 数据库服务 @@ -74,6 +79,10 @@ func NewApiClient(config *ApiClientConfig) (*ApiClient, error) { c.currentIp = config.CurrentIp } + c.config.os = runtime.GOOS + c.config.arch = runtime.GOARCH + c.config.maxProCs = runtime.GOMAXPROCS(0) + gormClient, gormTableName := config.GormClientFun() mongoClient, mongoDatabaseName, mongoCollectionName := config.MongoClientFun() diff --git a/vendor/go.dtapp.net/golog/api_gorm.go b/vendor/go.dtapp.net/golog/api_gorm.go index a7e02c8..b9e8191 100644 --- a/vendor/go.dtapp.net/golog/api_gorm.go +++ b/vendor/go.dtapp.net/golog/api_gorm.go @@ -83,25 +83,28 @@ func (c *ApiClient) gormAutoMigrate() (err error) { // 模型结构体 type apiPostgresqlLog struct { - LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号 - TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号 - RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间 - RequestUri string `gorm:"comment:【请求】链接" json:"request_uri,omitempty"` //【请求】链接 - RequestUrl string `gorm:"comment:【请求】链接" json:"request_url,omitempty"` //【请求】链接 - RequestApi string `gorm:"index;comment:【请求】接口" json:"request_api,omitempty"` //【请求】接口 - RequestMethod string `gorm:"index;comment:【请求】方式" json:"request_method,omitempty"` //【请求】方式 - RequestParams string `gorm:"comment:【请求】参数" json:"request_params,omitempty"` //【请求】参数 - RequestHeader string `gorm:"comment:【请求】头部" json:"request_header,omitempty"` //【请求】头部 - RequestIp string `gorm:"index;comment:【请求】请求Ip" json:"request_ip,omitempty"` //【请求】请求Ip - ResponseHeader string `gorm:"comment:【返回】头部" json:"response_header,omitempty"` //【返回】头部 - ResponseStatusCode int `gorm:"index;comment:【返回】状态码" json:"response_status_code,omitempty"` //【返回】状态码 - ResponseBody string `gorm:"comment:【返回】数据" json:"response_content,omitempty"` //【返回】数据 - ResponseContentLength int64 `gorm:"comment:【返回】大小" json:"response_content_length,omitempty"` //【返回】大小 - ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间 - SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名 - SystemInsideIp string `gorm:"index;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip - GoVersion string `gorm:"index;comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本 - SdkVersion string `gorm:"index;comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本 + LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号 + TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号 + RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间 + RequestUri string `gorm:"comment:【请求】链接" json:"request_uri,omitempty"` //【请求】链接 + RequestUrl string `gorm:"comment:【请求】链接" json:"request_url,omitempty"` //【请求】链接 + RequestApi string `gorm:"index;comment:【请求】接口" json:"request_api,omitempty"` //【请求】接口 + RequestMethod string `gorm:"index;comment:【请求】方式" json:"request_method,omitempty"` //【请求】方式 + RequestParams string `gorm:"comment:【请求】参数" json:"request_params,omitempty"` //【请求】参数 + RequestHeader string `gorm:"comment:【请求】头部" json:"request_header,omitempty"` //【请求】头部 + RequestIp string `gorm:"index;comment:【请求】请求Ip" json:"request_ip,omitempty"` //【请求】请求Ip + ResponseHeader string `gorm:"comment:【返回】头部" json:"response_header,omitempty"` //【返回】头部 + ResponseStatusCode int `gorm:"index;comment:【返回】状态码" json:"response_status_code,omitempty"` //【返回】状态码 + ResponseBody string `gorm:"comment:【返回】数据" json:"response_content,omitempty"` //【返回】数据 + ResponseContentLength int64 `gorm:"comment:【返回】大小" json:"response_content_length,omitempty"` //【返回】大小 + ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间 + SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名 + SystemInsideIp string `gorm:"index;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip + SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型 + SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构 + SystemCpuQuantity int `gorm:"index;comment:【系统】CPU核数" json:"system_cpu_quantity,omitempty"` //【系统】CPU核数 + GoVersion string `gorm:"index;comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本 + SdkVersion string `gorm:"index;comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本 } // 记录日志 @@ -119,6 +122,10 @@ func (c *ApiClient) gormRecord(ctx context.Context, postgresqlLog apiPostgresqlL postgresqlLog.RequestIp = c.currentIp + postgresqlLog.SystemOs = c.config.os + postgresqlLog.SystemArch = c.config.arch + postgresqlLog.SystemCpuQuantity = c.config.maxProCs + err = c.gormClient.Db.Table(c.gormConfig.tableName).Create(&postgresqlLog).Error if err != nil { c.zapLog.WithTraceId(ctx).Sugar().Errorf("[golog.api.gormRecord]:%s", err) diff --git a/vendor/go.dtapp.net/golog/api_mongo.go b/vendor/go.dtapp.net/golog/api_mongo.go index f2ca6cd..2966b32 100644 --- a/vendor/go.dtapp.net/golog/api_mongo.go +++ b/vendor/go.dtapp.net/golog/api_mongo.go @@ -119,6 +119,15 @@ func (c *ApiClient) mongoCreateIndexes() { c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{Keys: bson.D{ {"system_inside_ip", 1}, }})) + c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{Keys: bson.D{ + {"system_os", -1}, + }})) + c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{Keys: bson.D{ + {"system_arch", -1}, + }})) + c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{Keys: bson.D{ + {"system_cpu_quantity", 1}, + }})) c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{Keys: bson.D{ {"go_version", -1}, }})) @@ -146,6 +155,9 @@ type apiMongolLog struct { ResponseTime primitive.DateTime `json:"response_time,omitempty" bson:"response_time,omitempty"` //【返回】时间 SystemHostName string `json:"system_host_name,omitempty" bson:"system_host_name,omitempty"` //【系统】主机名 SystemInsideIp string `json:"system_inside_ip,omitempty" bson:"system_inside_ip,omitempty"` //【系统】内网ip + SystemOs string `json:"system_os,omitempty" bson:"system_os,omitempty"` //【系统】系统类型 + SystemArch string `json:"system_arch,omitempty" bson:"system_arch,omitempty"` //【系统】系统架构 + SystemCpuQuantity int `json:"system_cpu_quantity,omitempty" bson:"system_cpu_quantity,omitempty"` //【系统】CPU核数 GoVersion string `json:"go_version,omitempty" bson:"go_version,omitempty"` //【程序】Go版本 SdkVersion string `json:"sdk_version,omitempty" bson:"sdk_version,omitempty"` //【程序】Sdk版本 } @@ -159,10 +171,14 @@ func (c *ApiClient) mongoRecord(ctx context.Context, mongoLog apiMongolLog) (err mongoLog.TraceId = gotrace_id.GetTraceIdContext(ctx) - mongoLog.LogId = primitive.NewObjectID() - mongoLog.RequestIp = c.currentIp + mongoLog.SystemOs = c.config.os + mongoLog.SystemArch = c.config.arch + mongoLog.SystemCpuQuantity = c.config.maxProCs + + mongoLog.LogId = primitive.NewObjectID() + _, err = c.mongoClient.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).InsertOne(mongoLog) if err != nil { c.zapLog.WithTraceId(ctx).Sugar().Errorf("[golog.api.mongoRecord]:%s", err) diff --git a/vendor/go.dtapp.net/golog/const.go b/vendor/go.dtapp.net/golog/const.go index 6610869..ba1bdf5 100644 --- a/vendor/go.dtapp.net/golog/const.go +++ b/vendor/go.dtapp.net/golog/const.go @@ -1,5 +1,5 @@ package golog const ( - Version = "1.0.71" + Version = "1.0.72" ) diff --git a/vendor/go.dtapp.net/golog/gin.go b/vendor/go.dtapp.net/golog/gin.go index 1126b71..6e8e773 100644 --- a/vendor/go.dtapp.net/golog/gin.go +++ b/vendor/go.dtapp.net/golog/gin.go @@ -41,6 +41,11 @@ type GinClient struct { gorm bool // 日志开关 mongo bool // 日志开关 } + config struct { + os string // 系统类型 + arch string // 系统架构 + maxProCs int // CPU核数 + } } // client 数据库服务 @@ -75,6 +80,10 @@ func NewGinClient(config *GinClientConfig) (*GinClient, error) { c.logDebug = config.Debug + c.config.os = runtime.GOOS + c.config.arch = runtime.GOARCH + c.config.maxProCs = runtime.GOMAXPROCS(0) + gormClient, gormTableName := config.GormClientFun() mongoClient, mongoDatabaseName, mongoCollectionName := config.MongoClientFun() diff --git a/vendor/go.dtapp.net/golog/gin_gorm.go b/vendor/go.dtapp.net/golog/gin_gorm.go index eb38087..6848caf 100644 --- a/vendor/go.dtapp.net/golog/gin_gorm.go +++ b/vendor/go.dtapp.net/golog/gin_gorm.go @@ -110,6 +110,9 @@ type ginPostgresqlLog struct { CostTime int64 `gorm:"comment:【系统】花费时间" json:"cost_time,omitempty"` //【系统】花费时间 SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名 SystemInsideIp string `gorm:"index;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip + SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型 + SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构 + SystemCpuQuantity int `gorm:"index;comment:【系统】CPU核数" json:"system_cpu_quantity,omitempty"` //【系统】CPU核数 GoVersion string `gorm:"index;comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本 SdkVersion string `gorm:"index;comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本 } @@ -123,6 +126,10 @@ func (c *GinClient) gormRecord(postgresqlLog ginPostgresqlLog) (err error) { postgresqlLog.SdkVersion = Version + postgresqlLog.SystemOs = c.config.os + postgresqlLog.SystemArch = c.config.arch + postgresqlLog.SystemCpuQuantity = c.config.maxProCs + err = c.gormClient.Db.Table(c.gormConfig.tableName).Create(&postgresqlLog).Error if err != nil { c.zapLog.WithTraceIdStr(postgresqlLog.TraceId).Sugar().Errorf("[golog.gin.gormRecord]:%s", err) diff --git a/vendor/go.dtapp.net/golog/gin_mongo.go b/vendor/go.dtapp.net/golog/gin_mongo.go index 2c9a3c8..8c2e3b7 100644 --- a/vendor/go.dtapp.net/golog/gin_mongo.go +++ b/vendor/go.dtapp.net/golog/gin_mongo.go @@ -157,6 +157,18 @@ func (c *GinClient) mongoCreateIndexes() { Keys: bson.D{ {"system_inside_ip", 1}, }})) + c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{ + Keys: bson.D{ + {"system_os", -1}, + }})) + c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{ + Keys: bson.D{ + {"system_arch", -1}, + }})) + c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{ + Keys: bson.D{ + {"system_cpu_quantity", 1}, + }})) c.zapLog.WithLogger().Sugar().Infof(c.mongoClient.Db.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).Indexes().CreateOne(context.TODO(), mongo.IndexModel{ Keys: bson.D{ {"go_version", -1}, @@ -195,6 +207,9 @@ type ginMongoLog struct { CostTime int64 `json:"cost_time,omitempty" bson:"cost_time,omitempty"` //【系统】花费时间 SystemHostName string `json:"system_host_name,omitempty" bson:"system_host_name,omitempty"` //【系统】主机名 SystemInsideIp string `json:"system_inside_ip,omitempty" bson:"system_inside_ip,omitempty"` //【系统】内网ip + SystemOs string `json:"system_os,omitempty" bson:"system_os,omitempty"` //【系统】系统类型 + SystemArch string `json:"system_arch,omitempty" bson:"system_arch,omitempty"` //【系统】系统架构 + SystemCpuQuantity int `json:"system_cpu_quantity,omitempty" bson:"system_cpu_quantity,omitempty"` //【系统】CPU核数 GoVersion string `json:"go_version,omitempty" bson:"go_version,omitempty"` //【程序】Go版本 SdkVersion string `json:"sdk_version,omitempty" bson:"sdk_version,omitempty"` //【程序】Sdk版本 } @@ -208,6 +223,10 @@ func (c *GinClient) mongoRecord(mongoLog ginMongoLog) (err error) { mongoLog.SdkVersion = Version + mongoLog.SystemOs = c.config.os + mongoLog.SystemArch = c.config.arch + mongoLog.SystemCpuQuantity = c.config.maxProCs + mongoLog.LogId = primitive.NewObjectID() _, err = c.mongoClient.Database(c.mongoConfig.databaseName).Collection(c.mongoConfig.collectionName).InsertOne(mongoLog) diff --git a/vendor/go.dtapp.net/gorequest/.gitignore b/vendor/go.dtapp.net/gorequest/.gitignore index c316f13..27a3bc6 100644 --- a/vendor/go.dtapp.net/gorequest/.gitignore +++ b/vendor/go.dtapp.net/gorequest/.gitignore @@ -6,4 +6,3 @@ *.log *_test.go gomod.sh -/vendor/ diff --git a/vendor/go.dtapp.net/gorequest/url.go b/vendor/go.dtapp.net/gorequest/url.go new file mode 100644 index 0000000..8437b6e --- /dev/null +++ b/vendor/go.dtapp.net/gorequest/url.go @@ -0,0 +1,78 @@ +package gorequest + +import ( + "net/url" + "strings" +) + +type UriParse struct { + uri string +} + +func NewUri(uri string) *UriParse { + return &UriParse{uri: uri} +} + +// ResponseUrlParse 返回参数 +type ResponseUrlParse struct { + Uri string `json:"uri"` // URI + Urn string `json:"urn"` // URN + Url string `json:"url"` // URL + Scheme string `json:"scheme"` // 协议 + Host string `json:"host"` // 主机 + Hostname string `json:"hostname"` // 主机名 + Port string `json:"port"` // 端口 + Path string `json:"path"` // 路径 + RawQuery string `json:"raw_query"` // 参数 ? + Fragment string `json:"fragment"` // 片段 # +} + +// Parse 解析URl +func (u *UriParse) Parse() (resp ResponseUrlParse) { + parse, err := url.Parse(u.uri) + if err != nil { + return + } + resp.Uri = u.uri + resp.Urn = parse.Host + parse.Path + resp.Url = parse.Scheme + "://" + parse.Host + parse.Path + resp.Scheme = parse.Scheme + resp.Host = parse.Host + resp.Hostname = parse.Hostname() + resp.Port = parse.Port() + resp.Path = parse.Path + resp.RawQuery = parse.RawQuery + resp.Fragment = parse.Fragment + return +} + +// UriFilterExcludeQueryString 过滤掉url中的参数 +func (u *UriParse) UriFilterExcludeQueryString(uri string) string { + URL, _ := url.Parse(uri) + clearUri := strings.ReplaceAll(uri, URL.RawQuery, "") + clearUri = strings.TrimRight(clearUri, "?") + return strings.TrimRight(clearUri, "/") +} + +// LenCode 编码 +func LenCode(s string) string { + escape := url.QueryEscape(s) + return escape +} + +// DeCode 解码 +func DeCode(s string) string { + unescape, _ := url.QueryUnescape(s) + return unescape +} + +// ParseQuery 获取URL参数 https://studygolang.com/articles/2876 +func ParseQuery(s string) map[string][]string { + u, err := url.Parse(s) + if err != nil { + return nil + } + urlParam := u.RawQuery + m, _ := url.ParseQuery(urlParam) + return m +} diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go index 649fa87..9916e5e 100644 --- a/vendor/golang.org/x/sys/unix/syscall.go +++ b/vendor/golang.org/x/sys/unix/syscall.go @@ -29,8 +29,6 @@ import ( "bytes" "strings" "unsafe" - - "golang.org/x/sys/internal/unsafeheader" ) // ByteSliceFromString returns a NUL-terminated slice of bytes @@ -82,12 +80,7 @@ func BytePtrToString(p *byte) string { ptr = unsafe.Pointer(uintptr(ptr) + 1) } - var s []byte - h := (*unsafeheader.Slice)(unsafe.Pointer(&s)) - h.Data = unsafe.Pointer(p) - h.Len = n - h.Cap = n - + s := unsafe.Slice((*byte)(unsafe.Pointer(p)), n) return string(s) } diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go b/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go index 1596426..1259f6d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go @@ -7,11 +7,7 @@ package unix -import ( - "unsafe" - - "golang.org/x/sys/internal/unsafeheader" -) +import "unsafe" //sys closedir(dir uintptr) (err error) //sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) @@ -86,11 +82,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { } // Copy entry into return buffer. - var s []byte - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&s)) - hdr.Data = unsafe.Pointer(&entry) - hdr.Cap = reclen - hdr.Len = reclen + s := unsafe.Slice((*byte)(unsafe.Pointer(&entry)), reclen) copy(buf, s) buf = buf[reclen:] diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 1ff5060..9f75356 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -13,8 +13,6 @@ import ( "sync" "syscall" "unsafe" - - "golang.org/x/sys/internal/unsafeheader" ) var ( @@ -117,11 +115,7 @@ func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (d } // Use unsafe to convert addr into a []byte. - var b []byte - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b)) - hdr.Data = unsafe.Pointer(addr) - hdr.Cap = length - hdr.Len = length + b := unsafe.Slice((*byte)(unsafe.Pointer(addr)), length) // Register mapping in m and return it. p := &b[cap(b)-1] diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go index 0bb4c8d..5bb41d1 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -7,11 +7,7 @@ package unix -import ( - "unsafe" - - "golang.org/x/sys/internal/unsafeheader" -) +import "unsafe" // SysvShmAttach attaches the Sysv shared memory segment associated with the // shared memory identifier id. @@ -34,12 +30,7 @@ func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) { } // Use unsafe to convert addr into a []byte. - // TODO: convert to unsafe.Slice once we can assume Go 1.17 - var b []byte - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b)) - hdr.Data = unsafe.Pointer(addr) - hdr.Cap = int(info.Segsz) - hdr.Len = int(info.Segsz) + b := unsafe.Slice((*byte)(unsafe.Pointer(addr)), int(info.Segsz)) return b, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 132da14..834bdc9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -260,13 +260,13 @@ go.dtapp.net/goip go.dtapp.net/goip/ip2region go.dtapp.net/goip/v4 go.dtapp.net/goip/v6 -# go.dtapp.net/golog v1.0.71 +# go.dtapp.net/golog v1.0.72 ## explicit; go 1.19 go.dtapp.net/golog # go.dtapp.net/gorandom v1.0.1 ## explicit; go 1.18 go.dtapp.net/gorandom -# go.dtapp.net/gorequest v1.0.28 +# go.dtapp.net/gorequest v1.0.29 ## explicit; go 1.19 go.dtapp.net/gorequest # go.dtapp.net/gostring v1.0.10 @@ -342,7 +342,7 @@ golang.org/x/crypto/sha3 # golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 ## explicit; go 1.17 golang.org/x/mod/semver -# golang.org/x/net v0.0.0-20220907135653-1e95f45603a7 +# golang.org/x/net v0.0.0-20220909164309-bea034e7d591 ## explicit; go 1.17 golang.org/x/net/html golang.org/x/net/html/atom @@ -355,7 +355,7 @@ golang.org/x/net/idna # golang.org/x/sync v0.0.0-20220907140024-f12130a52804 ## explicit golang.org/x/sync/errgroup -# golang.org/x/sys v0.0.0-20220908164124-27713097b956 +# golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2 ## explicit; go 1.17 golang.org/x/sys/cpu golang.org/x/sys/internal/unsafeheader