diff --git a/go.mod b/go.mod index 10dac379..a8448e1d 100644 --- a/go.mod +++ b/go.mod @@ -8,8 +8,8 @@ require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/SongStitch/go-webp v1.2.0 github.com/fogleman/gg v1.3.0 - github.com/ggicci/httpin v0.10.1 - github.com/go-playground/validator/v10 v10.15.5 + github.com/ggicci/httpin v0.14.2 + github.com/go-playground/validator/v10 v10.16.0 github.com/justinas/alice v1.2.0 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/rs/zerolog v1.31.0 @@ -19,6 +19,7 @@ require ( require ( github.com/andybalholm/cascadia v1.3.2 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/ggicci/owl v0.4.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect @@ -26,10 +27,9 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/rs/xid v1.5.0 // indirect - github.com/stretchr/testify v1.8.4 // indirect golang.org/x/crypto v0.14.0 // indirect golang.org/x/image v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/text v0.14.0 // indirect ) diff --git a/go.sum b/go.sum index 9b2dbbcc..c297926a 100644 --- a/go.sum +++ b/go.sum @@ -13,31 +13,29 @@ github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= -github.com/ggicci/httpin v0.10.1 h1:qLHjEBjn/ErbUHFryeXYb6ZJtbt4B9dCAVd+Bl8GaxM= -github.com/ggicci/httpin v0.10.1/go.mod h1:RpidMNiWsPdLRwjuXAcvguOOWsEv0KS/ekjTp53UPqY= -github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8= -github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/ggicci/httpin v0.14.2 h1:rGrG/OgXg3XZbRBBcqf8TSeu1nW9XX6L9F42XGhwgRQ= +github.com/ggicci/httpin v0.14.2/go.mod h1:m/RhY5rRPkNQs4VMPK66LxBX4ZMPxPyXQvrnmBEo2Y8= +github.com/ggicci/owl v0.4.0 h1:1cwRlynLe6P5ylLyjNWtOP5qVO1bYUmziPYVbOphGHQ= +github.com/ggicci/owl v0.4.0/go.mod h1:TRPWshRwYej6uES//YW5aNgLB370URwyta1Ytfs7KXs= +github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0= +github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= -github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE= +github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/justinas/alice v1.2.0 h1:+MHSA/vccVCF4Uq37S42jwlkvI2Xzl7zTPCN5BnZNVo= github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNEe7i7qA= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= @@ -59,10 +57,6 @@ github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/sethvargo/go-envconfig v0.9.0 h1:Q6FQ6hVEeTECULvkJZakq3dZMeBQ3JUpcKMfPQbKMDE= github.com/sethvargo/go-envconfig v0.9.0/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0= -github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= -github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= -github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= -github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -81,7 +75,6 @@ golang.org/x/image v0.13.0 h1:3cge/F/QTkNLauhf2QoE9zp+7sr+ZcL4HnoZmdwg9sg= golang.org/x/image v0.13.0/go.mod h1:6mmbMOeV28HuMTgA6OSRkdXKYw/t5W9Uwn2Yv1r3Yxk= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -105,8 +98,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -117,10 +110,9 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= diff --git a/vendor/github.com/ggicci/httpin/README.md b/vendor/github.com/ggicci/httpin/README.md index 542df539..b9cc7cc5 100644 --- a/vendor/github.com/ggicci/httpin/README.md +++ b/vendor/github.com/ggicci/httpin/README.md @@ -44,9 +44,10 @@ You **only** need to define a struct to receive/bind data from an HTTP request, ```go type ListUsersInput struct { - Page int `in:"query=page"` - PerPage int `in:"query=per_page"` - IsMember bool `in:"query=is_member"` + Token string `in:"query=access_token;header=x-access-token"` + Page int `in:"query=page;default=1"` + PerPage int `in:"query=per_page;default=20"` + IsMember bool `in:"query=is_member"` } func ListUsers(rw http.ResponseWriter, r *http.Request) { @@ -98,7 +99,7 @@ func ListUsers(rw http.ResponseWriter, r *http.Request) { | 馃摉 Code Readability | 馃槦 Poor | 馃ぉ **Highly readable** | | 馃敤 Maintainability | 馃槨 Poor | 馃グ **Highly maintainable** | -## Alternatives +## Alternatives and Similars -- [google/go-querystring](https://github.com/google/go-querystring): encoding structs into URL query parameters - [gorilla/schema](https://github.com/gorilla/schema): converts structs to and from form values +- [google/go-querystring](https://github.com/google/go-querystring): encoding structs into URL query parameters diff --git a/vendor/github.com/ggicci/httpin/body.go b/vendor/github.com/ggicci/httpin/body.go index 4bfc1082..3c9f1b64 100644 --- a/vendor/github.com/ggicci/httpin/body.go +++ b/vendor/github.com/ggicci/httpin/body.go @@ -8,8 +8,10 @@ import ( "encoding/xml" "fmt" "io" - "reflect" + "net/http" "strings" + + "github.com/ggicci/owl" ) const ( @@ -18,12 +20,6 @@ const ( ) type ( - // JSONBody is the annotation for JSON body. - JSONBody struct{} - - // XMLBody is the annotation for XML body. - XMLBody struct{} - // BodyDecoder decodes the request body into the specified object. Common body types are: // json, xml, yaml, and others. BodyDecoder interface { @@ -32,9 +28,6 @@ type ( ) var ( - bodyTypeAnnotationJSON = reflect.TypeOf(JSONBody{}) - bodyTypeAnnotationXML = reflect.TypeOf(XMLBody{}) - bodyDecoders = map[string]BodyDecoder{ bodyTypeJSON: &defaultJSONBodyDecoder{}, bodyTypeXML: &defaultXMLBodyDecoder{}, @@ -43,9 +36,9 @@ var ( // RegisterBodyDecoder registers a new body decoder. Panic if the body type is already registered. // -// func init() { -// RegisterBodyDecoder("yaml", &myYAMLBodyDecoder{}) -// } +// func init() { +// RegisterBodyDecoder("yaml", &myYAMLBodyDecoder{}) +// } func RegisterBodyDecoder(bodyType string, decoder BodyDecoder) { if _, ok := bodyDecoders[bodyType]; ok { panic(fmt.Errorf("httpin: %w: %q", ErrDuplicateBodyDecoder, bodyType)) @@ -58,9 +51,9 @@ func RegisterBodyDecoder(bodyType string, decoder BodyDecoder) { // the default JSON decoder is borrowed from encoding/json. You can replace it with // your own implementation, e.g. json-iterator/go. // -// func init() { -// ReplaceBodyDecoder("json", &myJSONBodyDecoder{}) -// } +// func init() { +// ReplaceBodyDecoder("json", &myJSONBodyDecoder{}) +// } func ReplaceBodyDecoder(bodyType string, decoder BodyDecoder) { if bodyType == "" { panic("httpin: body type cannot be empty") @@ -68,7 +61,13 @@ func ReplaceBodyDecoder(bodyType string, decoder BodyDecoder) { bodyDecoders[bodyType] = decoder } -func bodyDirectiveNormalizer(dir *Directive) error { +// normalizeBodyDirective normalizes the body directive of the resolver. +// If no body type specified, the default type is "json". +func normalizeBodyDirective(r *owl.Resolver) error { + dir := r.GetDirective("body") + if dir == nil || dir.Name != "body" { + return nil + } if len(dir.Argv) == 0 { dir.Argv = []string{bodyTypeJSON} } @@ -81,33 +80,15 @@ func bodyDirectiveNormalizer(dir *Directive) error { return nil } -func bodyTypeString(bodyType reflect.Type) string { - switch bodyType { - case bodyTypeAnnotationJSON: - return bodyTypeJSON - case bodyTypeAnnotationXML: - return bodyTypeXML - default: - panic(fmt.Errorf("httpin: %w: %q", ErrUnknownBodyType, bodyType)) - } -} - -func bodyDecoder(ctx *DirectiveContext) error { +func bodyDecoder(rtm *DirectiveRuntime) error { var ( - bodyType = ctx.Argv[0] + req = rtm.Context.Value(RequestValue).(*http.Request) + bodyType = rtm.Directive.Argv[0] decoder = bodyDecoders[bodyType] ) - - if decoder == nil { - return ErrUnknownBodyType - } - - obj := ctx.Value.Interface() - if err := decoder.Decode(ctx.Request.Body, &obj); err != nil { + if err := decoder.Decode(req.Body, rtm.Value.Elem().Addr().Interface()); err != nil { return err } - - ctx.DeliverContextValue(StopRecursion, true) return nil } diff --git a/vendor/github.com/ggicci/httpin/builtindecoder.go b/vendor/github.com/ggicci/httpin/builtindecoder.go new file mode 100644 index 00000000..6aed54ad --- /dev/null +++ b/vendor/github.com/ggicci/httpin/builtindecoder.go @@ -0,0 +1,107 @@ +package httpin + +import ( + "fmt" + "strconv" + "time" +) + +func decodeBool(value string) (interface{}, error) { + return strconv.ParseBool(value) +} + +func decodeInt(value string) (interface{}, error) { + v, err := strconv.ParseInt(value, 10, 64) + return int(v), err +} + +func decodeInt8(value string) (interface{}, error) { + v, err := strconv.ParseInt(value, 10, 8) + return int8(v), err +} + +func decodeInt16(value string) (interface{}, error) { + v, err := strconv.ParseInt(value, 10, 16) + return int16(v), err +} + +func decodeInt32(value string) (interface{}, error) { + v, err := strconv.ParseInt(value, 10, 32) + return int32(v), err +} + +func decodeInt64(value string) (interface{}, error) { + v, err := strconv.ParseInt(value, 10, 64) + return int64(v), err +} + +func decodeUint(value string) (interface{}, error) { + v, err := strconv.ParseUint(value, 10, 64) + return uint(v), err +} + +func decodeUint8(value string) (interface{}, error) { + v, err := strconv.ParseUint(value, 10, 8) + return uint8(v), err +} + +func decodeUint16(value string) (interface{}, error) { + v, err := strconv.ParseUint(value, 10, 16) + return uint16(v), err +} + +func decodeUint32(value string) (interface{}, error) { + v, err := strconv.ParseUint(value, 10, 32) + return uint32(v), err +} + +func decodeUint64(value string) (interface{}, error) { + v, err := strconv.ParseUint(value, 10, 64) + return uint64(v), err +} + +func decodeFloat32(value string) (interface{}, error) { + v, err := strconv.ParseFloat(value, 32) + return float32(v), err +} + +func decodeFloat64(value string) (interface{}, error) { + v, err := strconv.ParseFloat(value, 64) + return float64(v), err +} + +func decodeComplex64(value string) (interface{}, error) { + v, err := strconv.ParseComplex(value, 64) + return complex64(v), err +} + +func decodeComplex128(value string) (interface{}, error) { + v, err := strconv.ParseComplex(value, 128) + return complex128(v), err +} + +func decodeString(value string) (interface{}, error) { + return value, nil +} + +// DecodeTime parses data bytes as time.Time in UTC timezone. +// Supported formats of the data bytes are: +// 1. RFC3339Nano string, e.g. "2006-01-02T15:04:05-07:00" +// 2. Unix timestamp, e.g. "1136239445" +func decodeTime(value string) (interface{}, error) { + // Try parsing value as RFC3339 format. + if t, err := time.Parse(time.RFC3339Nano, value); err == nil { + return t.UTC(), nil + } + + // Try parsing value as timestamp, both integer and float formats supported. + // e.g. "1618974933", "1618974933.284368". + if timestamp, err := strconv.ParseInt(value, 10, 64); err == nil { + return time.Unix(timestamp, 0).UTC(), nil + } + if timestamp, err := strconv.ParseFloat(value, 64); err == nil { + return time.Unix(0, int64(timestamp*float64(time.Second))).UTC(), nil + } + + return time.Time{}, fmt.Errorf("invalid time value") +} diff --git a/vendor/github.com/ggicci/httpin/core.go b/vendor/github.com/ggicci/httpin/core.go new file mode 100644 index 00000000..fdb095d2 --- /dev/null +++ b/vendor/github.com/ggicci/httpin/core.go @@ -0,0 +1,166 @@ +package httpin + +import ( + "context" + "fmt" + "mime" + "net/http" + "sync" + + "github.com/ggicci/owl" +) + +const ( + minimumMaxMemory = int64(1 << 10) // 1KB + defaultMaxMemory = int64(32 << 20) // 32 MB +) + +var builtResolvers sync.Map // map[reflect.Type]*owl.Resolver + +// Core is the core of httpin. It holds the resolver of a specific struct type. +// Who is responsible for decoding an HTTP request to an instance of such struct +// type. +type Core struct { + resolver *owl.Resolver + + errorHandler ErrorHandler + maxMemory int64 // in bytes +} + +// New creates a new Core instance, which holds the resolver of the inputStruct. +// - Use Core.Decode() to decode an HTTP request to an instance of the inputStruct. +// - Use NewInput() to create an HTTP middleware. +func New(inputStruct interface{}, opts ...Option) (*Core, error) { + resolver, err := buildResolver(inputStruct) + if err != nil { + return nil, err + } + + core := &Core{ + resolver: resolver, + } + + // Apply default options and user custom options to the core. + var allOptions []Option + defaultOptions := []Option{ + WithMaxMemory(defaultMaxMemory), + } + allOptions = append(allOptions, defaultOptions...) + allOptions = append(allOptions, opts...) + + for _, opt := range allOptions { + if err := opt(core); err != nil { + return nil, fmt.Errorf("httpin: invalid option: %w", err) + } + } + + return core, nil +} + +// buildResolver builds a resolver for the inputStruct. It will run normalizations +// on the resolver and cache it. +func buildResolver(inputStruct interface{}) (*owl.Resolver, error) { + resolver, err := owl.New(inputStruct) + if err != nil { + return nil, err + } + + // Returns the cached resolver if it's already built. + if cached, ok := builtResolvers.Load(resolver.Type); ok { + return cached.(*owl.Resolver), nil + } + + // Normalize the resolver before caching it. + if err := normalizeResolver(resolver); err != nil { + return nil, err + } + + // Cache the resolver. + builtResolvers.Store(resolver.Type, resolver) + return resolver, nil +} + +// normalizeResolver normalizes the resolvers by running a series of +// normalizations on every field resolver. +func normalizeResolver(r *owl.Resolver) error { + normalize := func(r *owl.Resolver) error { + for _, fn := range []func(*owl.Resolver) error{ + reserveDecoderDirective, + normalizeBodyDirective, + ensureDirectiveExecutorsRegistered, // always the last one + } { + if err := fn(r); err != nil { + return err + } + } + return nil + } + + return r.Iterate(normalize) +} + +// reserveDecoderDirective removes the "decoder" directive from the resolver. +// The "decoder" is a special directive which does nothing, but an indicator of +// overriding the decoder for a specific field. +func reserveDecoderDirective(r *owl.Resolver) error { + d := r.RemoveDirective("decoder") + if d == nil { + return nil + } + if len(d.Argv) == 0 { + return ErrMissingDecoderName + } + + decoder := decoderByName(d.Argv[0]) + if decoder == nil { + return ErrDecoderNotFound + } + r.Context = context.WithValue(r.Context, CustomDecoder, decoder) + return nil +} + +// ensureDirectiveExecutorsRegistered ensures all directives that defined in the +// resolver are registered in the executor registry. +func ensureDirectiveExecutorsRegistered(r *owl.Resolver) error { + for _, d := range r.Directives { + if owl.LookupExecutor(d.Name) == nil { + return fmt.Errorf("%w: %q", ErrUnregisteredExecutor, d.Name) + } + } + return nil +} + +// Decode decodes an HTTP request to a struct instance. +// The return value is a pointer to the input struct. +// For example: +// +// New(&Input{}).Decode(req) -> *Input +// New(Input{}).Decode(req) -> *Input +func (c *Core) Decode(req *http.Request) (interface{}, error) { + var err error + ct, _, _ := mime.ParseMediaType(req.Header.Get("Content-Type")) + if ct == "multipart/form-data" { + err = req.ParseMultipartForm(c.maxMemory) + } else { + err = req.ParseForm() + } + if err != nil { + return nil, err + } + + rv, err := c.resolver.Resolve(owl.WithValue(RequestValue, req)) + if err != nil { + return nil, NewInvalidFieldError(err.(*owl.ResolveError)) + } + return rv.Interface(), nil +} + +// getErrorHandler returns the error handler of the core if set, or the global +// custom error handler. +func (c *Core) getErrorHandler() ErrorHandler { + if c.errorHandler != nil { + return c.errorHandler + } + + return globalCustomErrorHandler +} diff --git a/vendor/github.com/ggicci/httpin/decoder.go b/vendor/github.com/ggicci/httpin/decoder.go new file mode 100644 index 00000000..a67ab018 --- /dev/null +++ b/vendor/github.com/ggicci/httpin/decoder.go @@ -0,0 +1,305 @@ +package httpin + +import ( + "fmt" + "mime/multipart" + "reflect" + "time" +) + +// primarySecondaryDecodersMap is a map of type to a pair of decoders. The first +// decoder is the primary decoder, while the second decoder is the secondary. +type primarySecondaryDecodersMap map[reflect.Type][2]interface{} + +var ( + builtinDecoders = make(primarySecondaryDecodersMap) // builtin decoders, always registered + customDecoders = make(primarySecondaryDecodersMap) // custom decoders (by type) + namedDecoders = make(map[string]interface{}) // custom decoders (by name) +) + +func init() { + registerTypeDecoderTo[bool](builtinDecoders, DecoderFunc[string](decodeBool), false) + registerTypeDecoderTo[int](builtinDecoders, DecoderFunc[string](decodeInt), false) + registerTypeDecoderTo[int8](builtinDecoders, DecoderFunc[string](decodeInt8), false) + registerTypeDecoderTo[int16](builtinDecoders, DecoderFunc[string](decodeInt16), false) + registerTypeDecoderTo[int32](builtinDecoders, DecoderFunc[string](decodeInt32), false) + registerTypeDecoderTo[int64](builtinDecoders, DecoderFunc[string](decodeInt64), false) + registerTypeDecoderTo[uint](builtinDecoders, DecoderFunc[string](decodeUint), false) + registerTypeDecoderTo[uint8](builtinDecoders, DecoderFunc[string](decodeUint8), false) + registerTypeDecoderTo[uint16](builtinDecoders, DecoderFunc[string](decodeUint16), false) + registerTypeDecoderTo[uint32](builtinDecoders, DecoderFunc[string](decodeUint32), false) + registerTypeDecoderTo[uint64](builtinDecoders, DecoderFunc[string](decodeUint64), false) + registerTypeDecoderTo[float32](builtinDecoders, DecoderFunc[string](decodeFloat32), false) + registerTypeDecoderTo[float64](builtinDecoders, DecoderFunc[string](decodeFloat64), false) + registerTypeDecoderTo[complex64](builtinDecoders, DecoderFunc[string](decodeComplex64), false) + registerTypeDecoderTo[complex128](builtinDecoders, DecoderFunc[string](decodeComplex128), false) + registerTypeDecoderTo[string](builtinDecoders, DecoderFunc[string](decodeString), false) + registerTypeDecoderTo[time.Time](builtinDecoders, DecoderFunc[string](decodeTime), false) +} + +// DataSource is the type of the input data. It can be string or *multipart.FileHeader. +// - string: when the input data is from a querystring, form, or header. +// - *multipart.FileHeader: when the input data is from a file upload. +type DataSource interface{ string | *multipart.FileHeader } + +// Decoder is the interface implemented by types that can decode a DataSource to +// themselves. +type Decoder[DT DataSource] interface { + Decode(value DT) (interface{}, error) +} + +// ValueTypeDecoder is the interface implemented by types that can decode a +// string to themselves. Take querystring as an example, the decoder takes in a +// single string value and decodes it to value of type T. +type ValueTypeDecoder = Decoder[string] + +// FileTypeDecoder is the interface implemented by types that can decode a +// *multipart.FileHeader to themselves. +type FileTypeDecoder = Decoder[*multipart.FileHeader] + +// DecoderFunc is a function that implements Decoder[DT]. It can be used to turn +// a function into a Decoder[DT]. For instance: +// +// func decodeInt(value string) (interface{}, error) { ... } +// myIntDecoder := DecoderFunc[string](decodeInt) +type DecoderFunc[DT DataSource] func(value DT) (interface{}, error) + +func (fn DecoderFunc[DT]) Decode(value DT) (interface{}, error) { + return fn(value) +} + +// decoder2D is the interface implemented by types that can decode a slice of +// DataSource to themselves. DecodeX[DT] takes in a slice of DT values and +// decodes them to some type of value. DecodeX[DT] is usually derived from +// Decoder[DT], using Decoder[DT] to decode each element of the slice. +type decoder2D[DT DataSource] interface { + DecodeX(values []DT) (interface{}, error) +} + +// RegisterValueTypeDecoder registers a ValueTypeDecoder. The decoder takes in a +// string value and decodes it to value of type T. Panics on conflict types and +// nil decoders. +// +// NOTE: the decoder returns the decoded value as interface{}. For best +// practice, the underlying type of the decoded value should be T, even +// returning *T also works. If the real returned value were not T or *T, the +// decoder will return an error (ErrValueTypeMismatch) while decoding. +func RegisterValueTypeDecoder[T any](decoder Decoder[string]) { + registerTypeDecoderTo[T](customDecoders, decoder, false) +} + +// RegisterFileTypeDecoder registers a FileTypeDecoder. The decoder takes in a +// *multipart.FileHeader (when uploading files from an HTTP request) and decodes +// it to value of type T. Panics on conflict types and nil decoders. +// +// NOTE: the decoder returns the decoded value as interface{}. For best +// practice, the underlying type of the decoded value should be T, even +// returning *T also works. If the real returned value were not T or *T, the +// decoder will return an error (ErrValueTypeMismatch) while decoding. +func RegisterFileTypeDecoder[T any](decoder Decoder[*multipart.FileHeader]) { + registerTypeDecoderTo[T](customDecoders, decoder, false) +} + +// ReplaceValueTypeDecoder works similar to RegisterValueTypeDecoder. But it +// replaces the decoder if there is a conflict. It still panics on nil decoders. +func ReplaceValueTypeDecoder[T any](decoder Decoder[string]) { + registerTypeDecoderTo[T](customDecoders, decoder, true) +} + +// ReplaceFileTypeDecoder works similar to RegisterFileTypeDecoder. But it +// replaces the decoder if there is a conflict. It still panics on nil decoders. +func ReplaceFileTypeDecoder[T any](decoder Decoder[*multipart.FileHeader]) { + registerTypeDecoderTo[T](customDecoders, decoder, true) +} + +// RegisterNamedDecoder registers a decoder by name. Panics on conflict names +// and invalid decoders. The decoder can be a ValueTypeDecoder or a +// FileTypeDecoder. It decodes the input value to a value of type T. Use the +// *decoder directive* to override the decoder of a struct field: +// +// RegisterNamedDecoder[time.Time]("x_time", DecoderFunc[string](decodeTimeInXFormat)) +// type Input struct { +// // httpin will use the decoder registered above, instead of the builtin decoder for time.Time. +// Time time.Time `in:"query:time;decoder=x_time"` +// } +// +// Visit https://ggicci.github.io/httpin/directives/decoder for more details. +func RegisterNamedDecoder[T any](name string, decoder interface{}) { + if _, ok := namedDecoders[name]; ok { + panic(fmt.Errorf("httpin: %w: %q", ErrDuplicateNamedDecoder, name)) + } + + ReplaceNamedDecoder[T](name, decoder) +} + +// ReplaceNamedDecoder works similar to RegisterNamedDecoder. But it replaces +// the decoder if there is a conflict. It still panics on invalid decoders. +func ReplaceNamedDecoder[T any](name string, decoder interface{}) { + panicOnInvalidDecoder(decoder) + typ := typeOf[T]() + namedDecoders[name] = adaptDecoder(typ, newSmartDecoderX(typ, decoder)) +} + +func registerTypeDecoderTo[T any](m primarySecondaryDecodersMap, decoder interface{}, force bool) { + typ := typeOf[T]() + panicOnInvalidDecoder(decoder) + + primaryDecoder := adaptDecoder(typ, newSmartDecoderX(typ, decoder)) + updateDecodersMap(m, typ, primaryDecoder, nil, force) + + if typ.Kind() == reflect.Pointer { + // When we have a pointer type (*T), we also register the decoder for + // its base type (T). The decoder for the base type will be registered + // as the secondary decoder. + baseType := typ.Elem() + secondaryDecoder := adaptDecoder(baseType, newSmartDecoderX(baseType, decoder)) + updateDecodersMap(m, baseType, nil, secondaryDecoder, force) + } else { + // When we have a non-pointer type (T), we also register the decoder + // for its pointer type (*T). The decoder for the pointer type will be + // registered as the secondary decoder. + pointerType := reflect.PtrTo(typ) + secondaryDecoder := adaptDecoder(pointerType, newSmartDecoderX(pointerType, decoder)) + updateDecodersMap(m, pointerType, nil, secondaryDecoder, force) + } +} + +// updateDecodersMap updates the decoders map with the given primary and +// secondary decoder. The given nil decoders will be ignored. The secondary +// decoder is always set. While the primary decoder is only set when the primary +// decoder of the given type is not set or force is true. +func updateDecodersMap(m map[reflect.Type][2]interface{}, typ reflect.Type, primary, secondary interface{}, force bool) { + olds, ok := m[typ] + + if !ok { + m[typ] = [2]interface{}{primary, secondary} + return + } + + oldPrimary, _ := olds[0], olds[1] + if primary != nil { // set primary + if oldPrimary != nil && !force { // conflict + panic(fmt.Errorf("httpin: %w: %q", ErrDuplicateTypeDecoder, typ)) + } + olds[0] = primary + } + + if secondary != nil { // always set secondary + olds[1] = secondary + } +} + +// smartDecoder is a decoder that switches the return value of the inner +// Decoder[DT] to WantType. For example, if the inner decoder returns a *T, and +// WantType is T, then the smartDecoder will return T instead of *T, vice versa. +type smartDecoder[DT DataSource] struct { + Decoder[DT] + WantType reflect.Type +} + +func newSmartDecoder[DT DataSource](typ reflect.Type, decoder interface{}) Decoder[DT] { + return &smartDecoder[DT]{decoder.(Decoder[DT]), typ} +} + +func newSmartDecoderX(typ reflect.Type, decoder interface{}) interface{} { + switch decoder := decoder.(type) { + case ValueTypeDecoder: + return newSmartDecoder[string](typ, decoder) + case FileTypeDecoder: + return newSmartDecoder[*multipart.FileHeader](typ, decoder) + default: + return nil + } +} + +func (sd *smartDecoder[DT]) Decode(value DT) (interface{}, error) { + if gotValue, err := sd.Decoder.Decode(value); err != nil { + return nil, err + } else { + // Returns directly on nil. + if gotValue == nil { + return nil, nil + } + + gotType := reflect.TypeOf(gotValue) + + // Returns directly on the same type. + if gotType == sd.WantType { + return gotValue, nil + } + + // Want T, got *T, return T. + if gotType.Kind() == reflect.Ptr && gotType.Elem() == sd.WantType { + return reflect.ValueOf(gotValue).Elem().Interface(), nil + } + + // Want *T, got T, return &T. + if sd.WantType.Kind() == reflect.Ptr && sd.WantType.Elem() == gotType { + res := reflect.New(gotType) + res.Elem().Set(reflect.ValueOf(gotValue)) + return res.Interface(), nil + } + + // Can't convert, return error. + return nil, mismatchedValueTypeError(sd.WantType, gotType) + } +} + +// panicOnInvalidDecoder panics when the decoder is invalid, check by +// validateDecoder. +func panicOnInvalidDecoder(decoder interface{}) { + if err := validateDecoder(decoder); err != nil { + panic(fmt.Errorf("httpin: %w", err)) + } +} + +// validateDecoder validates the decoder. It returns an error if the decoder is +// invalid, otherwise nil. +// 1. nil decoder --> ErrNilDecoder +// 2. not a ValueTypeDecoder or a FileTypeDecoder --> ErrInvalidDecoder +func validateDecoder(decoder interface{}) error { + if decoder == nil { + return ErrNilDecoder + } + if !isDecoder(decoder) { + return ErrInvalidDecoder + } + return nil +} + +// decoderByName retrieves a decoder by name, from the global registerred named decoders. +func decoderByName(name string) interface{} { + return namedDecoders[name] +} + +// decoderByType retrieves a decoder by type, from the global registerred decoders. +func decoderByType(t reflect.Type) interface{} { + if d := decoderByTypeFrom(customDecoders, t); d != nil { + return d + } + return decoderByTypeFrom(builtinDecoders, t) +} + +// decoderByTypeFrom retrieves a decoder by type, from a specific decoders map. +// It prioritizes the primary decoder over the secondary decoder. +func decoderByTypeFrom(m primarySecondaryDecodersMap, t reflect.Type) interface{} { + if decoders, ok := m[t]; ok { + if decoders[0] != nil { + return decoders[0] + } + if decoders[1] != nil { + return decoders[1] + } + } + return nil +} + +// isDecoder checks if the decoder is a ValueTypeDecoder or a FileTypeDecoder. +func isDecoder(decoder interface{}) bool { + _, isValueTypeDecoder := decoder.(Decoder[string]) + if isValueTypeDecoder { + return true + } + _, isFileTypeDecoder := decoder.(Decoder[*multipart.FileHeader]) + return isFileTypeDecoder +} diff --git a/vendor/github.com/ggicci/httpin/decoderadaptor.go b/vendor/github.com/ggicci/httpin/decoderadaptor.go new file mode 100644 index 00000000..a3088563 --- /dev/null +++ b/vendor/github.com/ggicci/httpin/decoderadaptor.go @@ -0,0 +1,161 @@ +package httpin + +import ( + "fmt" + "mime/multipart" + "reflect" +) + +type decoderKindType int + +const ( + decoderKindScalar decoderKindType = iota // T + decoderKindMulti // []T + decoderKindPatch // patch.Field[T] + decoderKindPatchMulti // patch.Field[[]T] +) + +type decoderAdaptor[DT DataSource] interface { + BaseType() reflect.Type // T + Scalar(reflect.Type) decoder2D[DT] // takes in a desired return type + Multi(reflect.Type) decoder2D[DT] + Patch(reflect.Type) decoder2D[DT] + PatchMulti(reflect.Type) decoder2D[DT] + DecoderByKind(kind decoderKindType, returnType reflect.Type) decoder2D[DT] +} + +// decoderAdaptorImpl is an implementation of decoderAdaptor. +// It can be adapted to 3 types of Decoder: +// +// - Call .Scalar() to get a Decoder that can be registered for type T. +// - Call .Multi() for []T. +// - Call .Patch() for patch.Field[T]. +// - Call .PatchMulti() for patch.Field[[]T]. +// +// Itself is also a ScalarTypeDecoder. +type decoderAdaptorImpl[DT DataSource] struct { + Decoder[DT] + baseType reflect.Type +} + +func (sva *decoderAdaptorImpl[DT]) BaseType() reflect.Type { + return sva.baseType +} + +func (sva *decoderAdaptorImpl[DT]) Scalar(returnType reflect.Type) decoder2D[DT] { + return &scalarTypeDecoder[DT]{sva, returnType} +} + +func (sva *decoderAdaptorImpl[DT]) Multi(returnType reflect.Type) decoder2D[DT] { + return &multiTypeDecoder[DT]{sva, returnType} +} + +func (sva *decoderAdaptorImpl[DT]) Patch(returnType reflect.Type) decoder2D[DT] { + return &patchFieldTypeDecoder[DT]{sva, returnType} +} + +func (sva *decoderAdaptorImpl[DT]) PatchMulti(returnType reflect.Type) decoder2D[DT] { + return &patchFieldMultiTypeDecoder[DT]{sva, returnType} +} + +func (sva *decoderAdaptorImpl[DT]) DecoderByKind(kind decoderKindType, returnType reflect.Type) decoder2D[DT] { + switch kind { + case decoderKindScalar: + return sva.Scalar(returnType) + case decoderKindMulti: + return sva.Multi(returnType) + case decoderKindPatch: + return sva.Patch(returnType) + case decoderKindPatchMulti: + return sva.PatchMulti(returnType) + } + return nil +} + +// adaptDecoder adapts a decoder (of Decoder[DT]) to a decoderAdaptor. +// It returns nil if the decoder is not supported. +func adaptDecoder(returnType reflect.Type, decoder interface{}) interface{} { + switch decoder := decoder.(type) { + case ValueTypeDecoder: + return &decoderAdaptorImpl[string]{decoder, returnType} + case FileTypeDecoder: + return &decoderAdaptorImpl[*multipart.FileHeader]{decoder, returnType} + default: + return nil + } +} + +type scalarTypeDecoder[DT DataSource] struct { + *decoderAdaptorImpl[DT] + ReturnType reflect.Type +} + +// DecodeX of scalarTypeDecoder[DT] decodes a single value. +// It only decodes the first value in the given slice. Returns T. +func (s *scalarTypeDecoder[DT]) DecodeX(values []DT) (interface{} /* T */, error) { + return s.Decoder.Decode(values[0]) +} + +type multiTypeDecoder[DT DataSource] struct { + *decoderAdaptorImpl[DT] + ReturnType reflect.Type +} + +// DecodeX of multiTypeDecoder[DT] decodes multiple values. Returns []T. +func (m *multiTypeDecoder[DT]) DecodeX(values []DT) (interface{} /* []T */, error) { + res := reflect.MakeSlice(m.ReturnType, len(values), len(values)) + for i, value := range values { + if gotValue, err := m.Decoder.Decode(value); err != nil { + return nil, fmt.Errorf("at index %d: %w", i, err) + } else { + res.Index(i).Set(reflect.ValueOf(gotValue)) + } + } + return res.Interface(), nil +} + +type patchFieldTypeDecoder[DT DataSource] struct { + *decoderAdaptorImpl[DT] + ReturnType reflect.Type +} + +// DecodeX of patchFieldTypeDecoder[DT] decodes a single value. +// It only decodes the first value in the given slice. Returns patch.Field[T]. +func (p *patchFieldTypeDecoder[DT]) DecodeX(values []DT) (interface{} /* patch.Field[T] */, error) { + res := reflect.New(p.ReturnType) + if gotValue, err := p.Decoder.Decode(values[0]); err != nil { + return res.Interface(), err + } else { + res.Elem().FieldByName("Value").Set(reflect.ValueOf(gotValue)) + res.Elem().FieldByName("Valid").SetBool(true) + return res.Elem().Interface(), nil + } +} + +type patchFieldMultiTypeDecoder[DT DataSource] struct { + *decoderAdaptorImpl[DT] + ReturnType reflect.Type +} + +// DecodeX of patchFieldMultiTypeDecoder[DT] decodes multiple values. Returns patch.Field[[]T]. +func (p *patchFieldMultiTypeDecoder[DT]) DecodeX(values []DT) (interface{} /* patch.Field[[]T] */, error) { + subValue := reflect.MakeSlice(reflect.SliceOf(p.BaseType()), len(values), len(values)) + for i, value := range values { + if gotValue, err := p.Decoder.Decode(value); err != nil { + return nil, fmt.Errorf("at index %d: %w", i, err) + } else { + subValue.Index(i).Set(reflect.ValueOf(gotValue)) + } + } + res := reflect.New(p.ReturnType) + res.Elem().FieldByName("Value").Set(subValue) + res.Elem().FieldByName("Valid").SetBool(true) + return res.Elem().Interface(), nil +} + +// typeOf returns the reflect.Type of a given type. +// e.g. typeOf[int]() returns reflect.TypeOf(0) +func typeOf[T any]() reflect.Type { + var zero [0]T + return reflect.TypeOf(zero).Elem() +} diff --git a/vendor/github.com/ggicci/httpin/decoders.go b/vendor/github.com/ggicci/httpin/decoders.go deleted file mode 100644 index 62c156c0..00000000 --- a/vendor/github.com/ggicci/httpin/decoders.go +++ /dev/null @@ -1,89 +0,0 @@ -package httpin - -import ( - "fmt" - "reflect" - - "github.com/ggicci/httpin/internal" -) - -// ValueTypeDecoder is the interface implemented by types that can decode a -// string to themselves. -type ValueTypeDecoder = internal.ValueTypeDecoder - -// FileTypeDecoder is the interface implemented by types that can decode a -// *multipart.FileHeader to themselves. -type FileTypeDecoder = internal.FileTypeDecoder - -// ValueTypeDecoderFunc is an adaptor to allow the use of ordinary functions as -// httpin `ValueTypeDecoder`s. -type ValueTypeDecoderFunc = internal.ValueTypeDecoderFunc - -// FileTypeDecoderFunc is an adaptor to allow the use of ordinary functions as -// httpin `FileTypeDecoder`s. -type FileTypeDecoderFunc = internal.FileTypeDecoderFunc - -var ( - decoders = make(map[reflect.Type]interface{}) // custom decoders - namedDecoders = make(map[string]interface{}) // custom decoders (registered by name) -) - -func isTypeDecoder(decoder interface{}) bool { - _, isValueTypeDecoder := decoder.(ValueTypeDecoder) - _, isFileTypeDecoder := decoder.(FileTypeDecoder) - return isValueTypeDecoder || isFileTypeDecoder -} - -// RegisterTypeDecoder registers a specific type decoder. Panics on conflicts. -func RegisterTypeDecoder(typ reflect.Type, decoder interface{}) { - if _, ok := decoders[typ]; ok { - panic(fmt.Errorf("httpin: %w: %q", ErrDuplicateTypeDecoder, typ)) - } - - ReplaceTypeDecoder(typ, decoder) -} - -// ReplaceTypeDecoder replaces a specific type decoder. -func ReplaceTypeDecoder(typ reflect.Type, decoder interface{}) { - ensureValidDecoder(typ, decoder) - decoders[typ] = decoder -} - -// RegisterNamedDecoder registers a decoder by name. Panics on conflicts. -func RegisterNamedDecoder(name string, decoder interface{}) { - if _, ok := namedDecoders[name]; ok { - panic(fmt.Errorf("httpin: %w: %q", ErrDuplicateNamedDecoder, name)) - } - - ReplaceNamedDecoder(name, decoder) -} - -// ReplaceNamedDecoder replaces a decoder by name. -func ReplaceNamedDecoder(name string, decoder interface{}) { - ensureValidDecoder(nil, decoder) - namedDecoders[name] = decoder -} - -func ensureValidDecoder(typ reflect.Type, decoder interface{}) { - if decoder == nil { - panic(fmt.Errorf("httpin: %w: %q", ErrNilTypeDecoder, typ)) - } - - if !isTypeDecoder(decoder) { - panic(fmt.Errorf("httpin: %w: %q", ErrInvalidTypeDecoder, typ)) - } -} - -// decoderOf retrieves a decoder by type, from the global registerred decoders. -func decoderOf(t reflect.Type) interface{} { - dec := decoders[t] - if dec != nil { - return dec - } - return internal.DecoderOf(t) -} - -// decoderByName retrieves a decoder by name, from the global registerred named decoders. -func decoderByName(name string) interface{} { - return namedDecoders[name] -} diff --git a/vendor/github.com/ggicci/httpin/default.go b/vendor/github.com/ggicci/httpin/default.go index 126b40de..6a8bd5e5 100644 --- a/vendor/github.com/ggicci/httpin/default.go +++ b/vendor/github.com/ggicci/httpin/default.go @@ -5,21 +5,20 @@ package httpin import "mime/multipart" -func defaultValueSetter(ctx *DirectiveContext) error { +func defaultValueSetter(ctx *DirectiveRuntime) error { if ctx.Context.Value(FieldSet) != nil { return nil // noop, the field was set by a former executor } // Transform: // 1. ctx.Argv -> input values - // 2. ["default"] -> ctx.Argv + // 2. ["default"] -> keys extractor := &extractor{ Form: multipart.Form{ Value: map[string][]string{ - "default": ctx.Argv, + "default": ctx.Directive.Argv, }, }, } - ctx.Argv = []string{"default"} - return extractor.Execute(ctx) + return extractor.Execute(ctx, "default") } diff --git a/vendor/github.com/ggicci/httpin/directive.go b/vendor/github.com/ggicci/httpin/directive.go new file mode 100644 index 00000000..736817ea --- /dev/null +++ b/vendor/github.com/ggicci/httpin/directive.go @@ -0,0 +1,73 @@ +package httpin + +import ( + "context" + "fmt" + "reflect" + + "github.com/ggicci/owl" +) + +type ( + Directive = owl.Directive + DirectiveRuntime = owl.DirectiveRuntime + DirectiveExecutor = owl.DirectiveExecutor + DirectiveExecutorFunc = owl.DirectiveExecutorFunc +) + +var reservedExecutorNames = []string{"decoder"} + +func init() { + // Built-in Directives + RegisterDirectiveExecutor("form", DirectiveExecutorFunc(formValueExtractor)) + RegisterDirectiveExecutor("query", DirectiveExecutorFunc(queryValueExtractor)) + RegisterDirectiveExecutor("header", DirectiveExecutorFunc(headerValueExtractor)) + RegisterDirectiveExecutor("body", DirectiveExecutorFunc(bodyDecoder)) + RegisterDirectiveExecutor("required", DirectiveExecutorFunc(required)) + RegisterDirectiveExecutor("default", DirectiveExecutorFunc(defaultValueSetter)) + + // decoder is a special executor which does nothing, but is an indicator of + // overriding the decoder for a specific field. + owl.RegisterDirectiveExecutor("decoder", DirectiveExecutorFunc(nil)) +} + +// RegisterDirectiveExecutor registers a named executor globally, which +// implemented the DirectiveExecutor interface. Will panic if the name were +// taken or nil executor. +func RegisterDirectiveExecutor(name string, exe DirectiveExecutor) { + panicOnReservedExecutorName(name) + owl.RegisterDirectiveExecutor(name, exe) +} + +// ReplaceDirectiveExecutor works like RegisterDirectiveExecutor without panic +// on duplicate names. +func ReplaceDirectiveExecutor(name string, exe DirectiveExecutor) { + panicOnReservedExecutorName(name) + owl.RegisterDirectiveExecutor(name, exe, true) +} + +func panicOnReservedExecutorName(name string) { + for _, reservedName := range reservedExecutorNames { + if name == reservedName { + panic(fmt.Errorf("httpin: %w: %q", ErrReservedExecutorName, name)) + } + } +} + +type directiveRuntimeHelper struct { + *DirectiveRuntime +} + +func (rw *directiveRuntimeHelper) decoderOf(elemType reflect.Type) interface{} { + decoder := rw.DirectiveRuntime.Resolver.Context.Value(CustomDecoder) + if decoder != nil { + return decoder + } + return decoderByType(elemType) +} + +func (rw *directiveRuntimeHelper) DeliverContextValue(key, value interface{}) { + rw.DirectiveRuntime.Context = context.WithValue( + rw.DirectiveRuntime.Context, key, value, + ) +} diff --git a/vendor/github.com/ggicci/httpin/directives.go b/vendor/github.com/ggicci/httpin/directives.go deleted file mode 100644 index 9205f872..00000000 --- a/vendor/github.com/ggicci/httpin/directives.go +++ /dev/null @@ -1,171 +0,0 @@ -package httpin - -import ( - "context" - "fmt" - "net/http" - "reflect" - "strings" -) - -var ( - executors = make(map[string]DirectiveExecutor) - normalizers = make(map[string]DirectiveNormalizer) - - reservedExecutorNames = map[string]struct{}{"decoder": {}} -) - -func init() { - // Built-in Directives - RegisterDirectiveExecutor("form", DirectiveExecutorFunc(formValueExtractor), nil) - RegisterDirectiveExecutor("query", DirectiveExecutorFunc(queryValueExtractor), nil) - RegisterDirectiveExecutor("header", DirectiveExecutorFunc(headerValueExtractor), nil) - RegisterDirectiveExecutor( - "body", - DirectiveExecutorFunc(bodyDecoder), - DirectiveNormalizerFunc(bodyDirectiveNormalizer), - ) - RegisterDirectiveExecutor("required", DirectiveExecutorFunc(required), nil) - RegisterDirectiveExecutor("default", DirectiveExecutorFunc(defaultValueSetter), nil) - - // decoder is a special executor which does nothing, but is an indicator of - // overriding the decoder for a specific field. - RegisterDirectiveExecutor("decoder", DirectiveExecutorFunc(noop), nil) -} - -// DirectiveExecutor is the interface implemented by a "directive executor". -type DirectiveExecutor interface { - Execute(*DirectiveContext) error -} - -type DirectiveNormalizer interface { - Normalize(*Directive) error -} - -// RegisterDirectiveExecutor registers a named executor globally, which -// implemented the DirectiveExecutor interface. Will panic if the name were -// taken or nil executor. -func RegisterDirectiveExecutor(name string, exe DirectiveExecutor, norm DirectiveNormalizer) { - if _, ok := executors[name]; ok { - panic(fmt.Errorf("httpin: %w: %q", ErrDuplicateExecutor, name)) - } - ReplaceDirectiveExecutor(name, exe, norm) -} - -// ReplaceDirectiveExecutor works like RegisterDirectiveExecutor without panic -// on duplicate names. -func ReplaceDirectiveExecutor(name string, exe DirectiveExecutor, norm DirectiveNormalizer) { - if exe == nil { - panic(fmt.Errorf("httpin: %w: %q", ErrNilExecutor, name)) - } - if _, ok := executors[name]; ok { - if _, ok := reservedExecutorNames[name]; ok { - panic(fmt.Errorf("httpin: %w: %q", ErrReservedExecutorName, name)) - } - } - executors[name] = exe - normalizers[name] = norm -} - -// DirectiveExecutorFunc is an adpator to allow to use of ordinary functions as -// httpin.DirectiveExecutor. -type DirectiveExecutorFunc func(*DirectiveContext) error - -// Execute calls f(ctx). -func (f DirectiveExecutorFunc) Execute(ctx *DirectiveContext) error { - return f(ctx) -} - -// DirectiveNormalizerFunc is an adaptor to allow to use of ordinary functions as -// httpin.DirectiveNormalizer. -type DirectiveNormalizerFunc func(*Directive) error - -// Normalize calls f(dir). -func (f DirectiveNormalizerFunc) Normalize(dir *Directive) error { - return f(dir) -} - -// DirectiveContext holds essential information about the field being resolved -// and the active HTTP request. Working as the context in a directive executor. -type DirectiveContext struct { - Directive - ValueType reflect.Type - Value reflect.Value - Request *http.Request - Context context.Context - - resolver *fieldResolver -} - -// DeliverContextValue binds a value to the specified key in the context. And it -// will be delivered among the executors in the same field resolver. -func (c *DirectiveContext) DeliverContextValue(key, value interface{}) { - c.Context = context.WithValue(c.Context, key, value) -} - -func (c *DirectiveContext) decoderOf(t reflect.Type) interface{} { - return c.resolver.decoderOf(t) -} - -// Directive defines the profile to locate an httpin.DirectiveExecutor instance -// and drive it with essential arguments. -type Directive struct { - Executor string // name of the executor - Argv []string // argv -} - -// buildDirective builds a `directive` by parsing a directive string extracted -// from the struct tag. -// -// Example directives are: -// "form=page,page_index" -> { Executor: "form", Args: ["page", "page_index"] } -// "header=x-api-token" -> { Executor: "header", Args: ["x-api-token"] } -func buildDirective(directiveStr string) (*Directive, error) { - parts := strings.SplitN(directiveStr, "=", 2) - executor := parts[0] - var argv []string - if len(parts) == 2 { - // Split the remained string by delimiter `,` as argv. - argv = strings.Split(parts[1], ",") - } - - // Ensure that the corresponding executor had been registered. - dir := &Directive{Executor: executor, Argv: argv} - if dir.getExecutor() == nil { - return nil, fmt.Errorf("%w: %q", ErrUnregisteredExecutor, dir.Executor) - } - - // Normalize the directive. - norm := dir.getNormalizer() - if norm != nil { - if err := norm.Normalize(dir); err != nil { - return nil, fmt.Errorf("invalid directive %q: %w", dir.Executor, err) - } - } - - return dir, nil -} - -// Execute locates the executor and runs it with the specified context. -func (d *Directive) Execute(ctx *DirectiveContext) error { - return d.getExecutor().Execute(ctx) -} - -// getExecutor locates the executor by its name. It must exist. -func (d *Directive) getExecutor() DirectiveExecutor { - return executors[d.Executor] -} - -// getNormalizer locates the directive normalizer by its name. -func (d *Directive) getNormalizer() DirectiveNormalizer { - return normalizers[d.Executor] -} - -func (d *Directive) isDecoderSpecifier() bool { - return d.Executor == "decoder" -} - -// noop is a no-operation directive executor. -func noop(_ *DirectiveContext) error { - return nil -} diff --git a/vendor/github.com/ggicci/httpin/errors.go b/vendor/github.com/ggicci/httpin/errors.go index 533293a1..befb97f8 100644 --- a/vendor/github.com/ggicci/httpin/errors.go +++ b/vendor/github.com/ggicci/httpin/errors.go @@ -4,42 +4,42 @@ import ( "errors" "fmt" "reflect" + + "github.com/ggicci/owl" ) var ( - ErrMissingField = errors.New("missing required field") - ErrUnsupporetedType = errors.New("unsupported type") - ErrUnregisteredExecutor = errors.New("unregistered executor") - ErrDuplicateTypeDecoder = errors.New("duplicate type decoder") - ErrDuplicateNamedDecoder = errors.New("duplicate named decoder") - ErrNilTypeDecoder = errors.New("nil type decoder") - ErrInvalidTypeDecoder = errors.New("invalid type decoder") - ErrDuplicateExecutor = errors.New("duplicate executor") - ErrReservedExecutorName = errors.New("reserved executor name") - ErrNilExecutor = errors.New("nil executor") - ErrUnknownBodyType = errors.New("unknown body type") - ErrDuplicateAnnotationField = errors.New("duplicate annotation field") - ErrNilErrorHandler = errors.New("nil error handler") - ErrMaxMemoryTooSmall = errors.New("max memory too small") - ErrNilFile = errors.New("nil file") - ErrDuplicateBodyDecoder = errors.New("duplicate body decoder") - ErrMissingDecoderName = errors.New("missing decoder name") - ErrDecoderNotFound = errors.New("decoder not found") + ErrMissingField = errors.New("missing required field") + ErrUnsupporetedType = errors.New("unsupported type") + ErrUnregisteredExecutor = errors.New("unregistered executor") + ErrDuplicateTypeDecoder = errors.New("duplicate type decoder") + ErrDuplicateNamedDecoder = errors.New("duplicate named decoder") + ErrNilDecoder = errors.New("nil decoder") + ErrInvalidDecoder = errors.New("invalid decoder") + ErrReservedExecutorName = errors.New("reserved executor name") + ErrUnknownBodyType = errors.New("unknown body type") + ErrNilErrorHandler = errors.New("nil error handler") + ErrMaxMemoryTooSmall = errors.New("max memory too small") + ErrNilFile = errors.New("nil file") + ErrDuplicateBodyDecoder = errors.New("duplicate body decoder") + ErrMissingDecoderName = errors.New("missing decoder name") + ErrDecoderNotFound = errors.New("decoder not found") + ErrValueTypeMismatch = errors.New("value type mismatch") ) -type UnsupportedTypeError struct { - Type reflect.Type -} - -func (e UnsupportedTypeError) Error() string { - return fmt.Sprintf("unsupported type: %q", e.Type) +func mismatchedValueTypeError(expected, got reflect.Type) error { + return fmt.Errorf("%w: the decoder returned value of type %q is not assignable to type %q", + ErrValueTypeMismatch, got, expected) } -func (e UnsupportedTypeError) Unwrap() error { - return ErrUnsupporetedType +func unsupportedTypeError(typ reflect.Type) error { + return fmt.Errorf("%w: %q", ErrUnsupporetedType, typ) } type InvalidFieldError struct { + // err is the underlying error thrown by the directive executor. + err error + // Field is the name of the field. Field string `json:"field"` @@ -47,25 +47,45 @@ type InvalidFieldError struct { // e.g. form, header, required, etc. Source string `json:"source"` + // Key is the key to get the input data from the source. + Key string `json:"key"` + // Value is the input data. Value interface{} `json:"value"` - // internalError is the underlying error thrown by the directive executor. - internalError error - // ErrorMessage is the string representation of `internalError`. ErrorMessage string `json:"error"` +} - // directives is the list of directives bound to the field. - Directives []*Directive `json:"-"` +func (e *InvalidFieldError) Error() string { + return fmt.Sprintf("invalid field %q: %v", e.Field, e.err) } -func (f *InvalidFieldError) Error() string { - return fmt.Sprintf("invalid field %q: %v", f.Field, f.internalError) +func (e *InvalidFieldError) Unwrap() error { + return e.err } -func (f *InvalidFieldError) Unwrap() error { - return f.internalError +func NewInvalidFieldError(err *owl.ResolveError) *InvalidFieldError { + r := err.Resolver + de := err.AsDirectiveExecutionError() + + var fe *fieldError + var inputKey string + var inputValue interface{} + errors.As(err, &fe) + if fe != nil { + inputValue = fe.Value + inputKey = fe.Key + } + + return &InvalidFieldError{ + err: err, + Field: r.Field.Name, + Source: de.Name, // e.g. form, header, required, etc. + Key: inputKey, + Value: inputValue, + ErrorMessage: err.Error(), + } } type fieldError struct { diff --git a/vendor/github.com/ggicci/httpin/extractor.go b/vendor/github.com/ggicci/httpin/extractor.go index 36a73164..ada7e642 100644 --- a/vendor/github.com/ggicci/httpin/extractor.go +++ b/vendor/github.com/ggicci/httpin/extractor.go @@ -1,7 +1,6 @@ package httpin import ( - "fmt" "mime/multipart" "net/http" "reflect" @@ -30,8 +29,11 @@ func newExtractor(r *http.Request) *extractor { } } -func (e *extractor) Execute(ctx *DirectiveContext) error { - for _, key := range ctx.Directive.Argv { +func (e *extractor) Execute(ctx *DirectiveRuntime, keys ...string) error { + if len(keys) == 0 { + keys = ctx.Directive.Argv + } + for _, key := range keys { if e.KeyNormalizer != nil { key = e.KeyNormalizer(key) } @@ -42,8 +44,8 @@ func (e *extractor) Execute(ctx *DirectiveContext) error { return nil } -func (e *extractor) extract(ctx *DirectiveContext, key string) error { - if ctx.Context.Value(FieldSet) == true { +func (e *extractor) extract(rtm *DirectiveRuntime, key string) error { + if rtm.Context.Value(FieldSet) == true { return nil } @@ -55,82 +57,67 @@ func (e *extractor) extract(ctx *DirectiveContext, key string) error { return nil } - // NOTE(ggicci): Array? - if ctx.ValueType.Kind() == reflect.Slice { - return e.extractMulti(ctx, key) - } + rtmHelper := directiveRuntimeHelper{rtm} + valueType := rtm.Value.Type().Elem() + elemType, decoderKind := scalarElemTypeOf(valueType) + decoder := rtmHelper.decoderOf(elemType) - switch decoder := ctx.decoderOf(ctx.ValueType).(type) { - case ValueTypeDecoder: - if gotValue, interfaceValue, err := decodeValueAt(decoder, e.Form.Value[key], 0); err != nil { - return fieldError{key, gotValue, err} - } else { - ctx.Value.Elem().Set(reflect.ValueOf(interfaceValue)) - } - case FileTypeDecoder: - if gotFile, interfaceValue, err := decodeFileAt(decoder, e.Form.File[key], 0); err != nil { - return fieldError{key, gotFile, err} - } else { - ctx.Value.Elem().Set(reflect.ValueOf(interfaceValue)) - } - default: - return UnsupportedTypeError{ctx.ValueType} - } - - ctx.DeliverContextValue(FieldSet, true) - return nil -} + var decodedValue interface{} + var err error -func (e *extractor) extractMulti(ctx *DirectiveContext, key string) error { - var ( - theSlice reflect.Value - elemType = ctx.ValueType.Elem() - values = e.Form.Value[key] - files = e.Form.File[key] - ) - - switch decoder := ctx.decoderOf(elemType).(type) { - case ValueTypeDecoder: - theSlice = reflect.MakeSlice(ctx.ValueType, len(values), len(values)) - for i := 0; i < len(values); i++ { - if _, interfaceValue, err := decodeValueAt(decoder, values, i); err != nil { - return fieldError{key, values, fmt.Errorf("at index %d: %w", i, err)} - } else { - theSlice.Index(i).Set(reflect.ValueOf(interfaceValue)) - } - } - case FileTypeDecoder: - theSlice = reflect.MakeSlice(ctx.ValueType, len(files), len(files)) - for i := 0; i < len(files); i++ { - if _, interfaceValue, err := decodeFileAt(decoder, files, i); err != nil { - return fieldError{key, files, fmt.Errorf("at index %d: %w", i, err)} - } else { - theSlice.Index(i).Set(reflect.ValueOf(interfaceValue)) - } - } + switch ada := decoder.(type) { + case decoderAdaptor[string]: + decodedValue, err = ada.DecoderByKind(decoderKind, valueType).DecodeX(values) + case decoderAdaptor[*multipart.FileHeader]: + decodedValue, err = ada.DecoderByKind(decoderKind, valueType).DecodeX(files) default: - return UnsupportedTypeError{ctx.ValueType} + err = unsupportedTypeError(elemType) } - ctx.Value.Elem().Set(theSlice) - ctx.DeliverContextValue(FieldSet, true) + if err == nil { + err = setDirectiveRuntimeValue(rtm, decodedValue) + } + if err != nil { + return &fieldError{key, values, err} + } + rtmHelper.DeliverContextValue(FieldSet, true) return nil } -func decodeValueAt(decoder ValueTypeDecoder, values []string, index int) (string, interface{}, error) { - var gotValue = "" - if index < len(values) { - gotValue = values[index] +func setDirectiveRuntimeValue(rtm *DirectiveRuntime, value interface{}) error { + if value == nil { + // NOTE: should we wipe the value here? i.e. set the value to nil if necessary. + // No case found yet, at lease for now. + return nil } - res, err := decoder.Decode(gotValue) - return gotValue, res, err + newValue := reflect.ValueOf(value) + targetType := rtm.Value.Type().Elem() + if newValue.Type().AssignableTo(targetType) { + rtm.Value.Elem().Set(newValue) + return nil + } + return mismatchedValueTypeError(targetType, reflect.TypeOf(value)) } -func decodeFileAt(decoder FileTypeDecoder, files []*multipart.FileHeader, index int) (*multipart.FileHeader, interface{}, error) { - var gotFile *multipart.FileHeader - if index < len(files) { - gotFile = files[index] +// scalarElemTypeOf returns the scalar element type of a given type. +// - T -> T, decoderKindScalar +// - []T -> T, decoderKindMulti +// - patch.Field[T] -> T, decoderKindPatch +// - patch.Field[[]T] -> T, decoderKindPatchMulti +// +// The given type is gonna use the decoder of the scalar element type to decode +// the input values. +func scalarElemTypeOf(valueType reflect.Type) (reflect.Type, decoderKindType) { + if valueType.Kind() == reflect.Slice { + return valueType.Elem(), decoderKindMulti + } + if isPatchField(valueType) { + subElemType, isMulti := patchFieldElemType(valueType) + if isMulti { + return subElemType, decoderKindPatchMulti + } else { + return subElemType, decoderKindPatch + } } - res, err := decoder.Decode(gotFile) - return gotFile, res, err + return valueType, decoderKindScalar } diff --git a/vendor/github.com/ggicci/httpin/file.go b/vendor/github.com/ggicci/httpin/file.go index d39ded3d..95b98f80 100644 --- a/vendor/github.com/ggicci/httpin/file.go +++ b/vendor/github.com/ggicci/httpin/file.go @@ -3,13 +3,11 @@ package httpin import ( - "fmt" "mime/multipart" - "reflect" ) func init() { - RegisterTypeDecoder(reflect.TypeOf(File{}), FileTypeDecoderFunc(decodeFile)) + registerTypeDecoderTo[File](builtinDecoders, DecoderFunc[*multipart.FileHeader](decodeFile), false) } type File struct { @@ -27,7 +25,7 @@ func decodeFile(fileHeader *multipart.FileHeader) (interface{}, error) { inFile.Header = fileHeader file, err := fileHeader.Open() if err != nil { - return inFile, fmt.Errorf("open file: %w", err) + return inFile, err } inFile.File = file diff --git a/vendor/github.com/ggicci/httpin/form.go b/vendor/github.com/ggicci/httpin/form.go index 68b3d9a0..28c6fb47 100644 --- a/vendor/github.com/ggicci/httpin/form.go +++ b/vendor/github.com/ggicci/httpin/form.go @@ -3,8 +3,11 @@ package httpin +import "net/http" + // formValueExtractor implements the "form" executor who extracts values from // the forms of an HTTP request. -func formValueExtractor(ctx *DirectiveContext) error { - return newExtractor(ctx.Request).Execute(ctx) +func formValueExtractor(ctx *DirectiveRuntime) error { + req := ctx.Context.Value(RequestValue).(*http.Request) + return newExtractor(req).Execute(ctx) } diff --git a/vendor/github.com/ggicci/httpin/gochi.go b/vendor/github.com/ggicci/httpin/gochi.go index a02c8a93..3507dd4d 100644 --- a/vendor/github.com/ggicci/httpin/gochi.go +++ b/vendor/github.com/ggicci/httpin/gochi.go @@ -17,22 +17,23 @@ type GochiURLParamFunc func(r *http.Request, key string) string // // Usage: // -// func init() { -// httpin.UseGochiURLParam("path", chi.URLParam) -// } -func UseGochiURLParam(executor string, fn GochiURLParamFunc) { - RegisterDirectiveExecutor(executor, &gochiURLParamExtractor{URLParam: fn}, nil) +// func init() { +// httpin.UseGochiURLParam("path", chi.URLParam) +// } +func UseGochiURLParam(directive string, fn GochiURLParamFunc) { + RegisterDirectiveExecutor(directive, &gochiURLParamExtractor{URLParam: fn}) } type gochiURLParamExtractor struct { URLParam GochiURLParamFunc } -func (chi *gochiURLParamExtractor) Execute(ctx *DirectiveContext) error { - var kvs = make(map[string][]string) +func (chi *gochiURLParamExtractor) Execute(ctx *DirectiveRuntime) error { + req := ctx.Context.Value(RequestValue).(*http.Request) + kvs := make(map[string][]string) - for _, key := range ctx.Argv { - value := chi.URLParam(ctx.Request, key) + for _, key := range ctx.Directive.Argv { + value := chi.URLParam(req, key) if value != "" { kvs[key] = []string{value} } diff --git a/vendor/github.com/ggicci/httpin/gorilla.go b/vendor/github.com/ggicci/httpin/gorilla.go index 59531f95..b7d08628 100644 --- a/vendor/github.com/ggicci/httpin/gorilla.go +++ b/vendor/github.com/ggicci/httpin/gorilla.go @@ -16,20 +16,22 @@ type GorillaMuxVarsFunc func(*http.Request) map[string]string // // Usage: // -// func init() { -// httpin.UseGorillaMux("path", mux.Vars) -// } +// func init() { +// httpin.UseGorillaMux("path", mux.Vars) +// } func UseGorillaMux(executor string, fnVars GorillaMuxVarsFunc) { - RegisterDirectiveExecutor(executor, &gorillaMuxVarsExtractor{Vars: fnVars}, nil) + RegisterDirectiveExecutor(executor, &gorillaMuxVarsExtractor{Vars: fnVars}) } type gorillaMuxVarsExtractor struct { Vars GorillaMuxVarsFunc } -func (mux *gorillaMuxVarsExtractor) Execute(ctx *DirectiveContext) error { - var kvs = make(map[string][]string) - for key, value := range mux.Vars(ctx.Request) { +func (mux *gorillaMuxVarsExtractor) Execute(ctx *DirectiveRuntime) error { + req := ctx.Context.Value(RequestValue).(*http.Request) + kvs := make(map[string][]string) + + for key, value := range mux.Vars(req) { kvs[key] = []string{value} } diff --git a/vendor/github.com/ggicci/httpin/header.go b/vendor/github.com/ggicci/httpin/header.go index 7e808ef0..44265b5a 100644 --- a/vendor/github.com/ggicci/httpin/header.go +++ b/vendor/github.com/ggicci/httpin/header.go @@ -10,10 +10,11 @@ import ( // headerValueExtractor implements the "header" executor who extracts values // from the HTTP headers. -func headerValueExtractor(ctx *DirectiveContext) error { +func headerValueExtractor(ctx *DirectiveRuntime) error { + req := ctx.Context.Value(RequestValue).(*http.Request) extractor := &extractor{ Form: multipart.Form{ - Value: ctx.Request.Header, + Value: req.Header, }, KeyNormalizer: http.CanonicalHeaderKey, } diff --git a/vendor/github.com/ggicci/httpin/httpin.go b/vendor/github.com/ggicci/httpin/httpin.go index 83365ad2..6e23e4ea 100644 --- a/vendor/github.com/ggicci/httpin/httpin.go +++ b/vendor/github.com/ggicci/httpin/httpin.go @@ -4,133 +4,137 @@ package httpin import ( + "context" + "encoding/json" + "errors" "fmt" - "mime" "net/http" "reflect" - "sync" ) type ContextKey int const ( - minimumMaxMemory = 1 << 10 // 1KB - defaultMaxMemory = 32 << 20 // 32 MB - // Input is the key to get the input object from Request.Context() injected by httpin. e.g. // // input := r.Context().Value(httpin.Input).(*InputStruct) Input ContextKey = iota + // RequestValue is the key to get the HTTP request value (of *http.Request) + // from DirectiveRuntime.Context. The HTTP request value is injected by + // httpin to the context of DirectiveRuntime before executing the directive. + // See Core.Decode() for more details. + RequestValue + + // CustomDecoder is the key to get the custom decoder for a field from + // Resolver.Context. Which is specified by the "decoder" directive. + // During resolver building phase, the "decoder" directive will be removed + // from the resolver, and the targeted decoder by name will be put into + // Resolver.Context with this key. e.g. + // + // type GreetInput struct { + // Message string `httpin:"decoder=custom"` + // } + // For the above example, the decoder named "custom" will be put into the + // resolver of Message field with this key. + CustomDecoder + // FieldSet is used by executors to tell whether a field has been set. When // multiple executors were applied to a field, if the field value were set // by a former executor, the latter executors MAY skip running by consulting // this context value. FieldSet - - StopRecursion ) -var builtEngines sync.Map - -// Engine holds the information on how to decode a request to an instance of a -// concrete struct type. -type Engine struct { - // core - inputType reflect.Type - tree *fieldResolver - - // options - errorHandler ErrorHandler - maxMemory int64 // in bytes -} - -// New builds an HTTP request decoder for the specified struct type with custom options. -func New(inputStruct interface{}, opts ...Option) (*Engine, error) { - typ := reflect.TypeOf(inputStruct) // retrieve type information - if typ == nil { - return nil, fmt.Errorf("httpin: nil input type") - } +var ( + globalCustomErrorHandler ErrorHandler = defaultErrorHandler +) - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() +// ErrorHandler is the type of custom error handler. The error handler is used +// by the http.Handler that created by NewInput() to handle errors during +// decoding the HTTP request. +type ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) + +// Decode decodes an HTTP request to the given input struct. The input must be a +// pointer to a struct instance. For example: +// +// input := &InputStruct{} +// if err := Decode(req, &input); err != nil { ... } +// +// input is now populated with data from the request. +func Decode(req *http.Request, input interface{}) error { + originalType := reflect.TypeOf(input) + if originalType.Kind() != reflect.Ptr { + return fmt.Errorf("httpin: input must be a pointer") } - if typ.Kind() != reflect.Struct { - return nil, UnsupportedTypeError{Type: typ} + core, err := New(originalType.Elem()) + if err != nil { + return err } - - var core *Engine - - builtEngine, built := builtEngines.Load(typ) - if !built { - // Build the engine core if not built yet. - core = &Engine{inputType: typ} - if err := core.build(); err != nil { - return nil, fmt.Errorf("httpin: %w", err) - } - builtEngines.Store(typ, core) + if value, err := core.Decode(req); err != nil { + return err } else { - // Load the engine core and get a copy. - core = copyEngineCore(builtEngine.(*Engine)) - } - // Apply default options and user custom options to the engine. - var allOptions []Option - defaultOptions := []Option{ - WithMaxMemory(defaultMaxMemory), - } - allOptions = append(allOptions, defaultOptions...) - allOptions = append(allOptions, opts...) - - for _, opt := range allOptions { - if err := opt(core); err != nil { - return nil, fmt.Errorf("httpin: invalid option: %w", err) + if originalType.Elem().Kind() == reflect.Ptr { + reflect.ValueOf(input).Elem().Set(reflect.ValueOf(value)) + } else { + reflect.ValueOf(input).Elem().Set(reflect.ValueOf(value).Elem()) } + return nil } - - return core, nil } -// Decode decodes an HTTP request to a struct instance. -func (e *Engine) Decode(req *http.Request) (interface{}, error) { - var err error - ct, _, _ := mime.ParseMediaType(req.Header.Get("Content-Type")) - if ct == "multipart/form-data" { - err = req.ParseMultipartForm(e.maxMemory) - } else { - err = req.ParseForm() - } - +// NewInput creates a "Middleware". A middleware is a function that takes a +// http.Handler and returns another http.Handler. +// +// The middleware created by NewInput is to add the decoding function to an +// existing http.Handler. This functionality will decode the HTTP request and +// put the decoded struct instance to the request's context. So that the next +// hop can get the decoded struct instance from the request's context. +// +// We recommend using https://github.com/justinas/alice to chain your +// middlewares. If you're using some popular web frameworks, they may have +// already provided a middleware chaining mechanism. +func NewInput(inputStruct interface{}, opts ...Option) func(http.Handler) http.Handler { + core, err := New(inputStruct, opts...) if err != nil { - return nil, err + panic(fmt.Errorf("httpin: %w", err)) } - rv, err := e.tree.resolve(req) - if err != nil { - return nil, fmt.Errorf("httpin: %w", err) - } - return rv.Interface(), nil -} -// build builds extractors for the exported fields of the input struct. -func (e *Engine) build() error { - tree, err := buildResolverTree(e.inputType) - if err != nil { - return err + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + // Here we read the request and decode it to fill our structure. + // Once failed, the request should end here. + input, err := core.Decode(r) + if err != nil { + core.getErrorHandler()(rw, r, err) + return + } + + // We put the `input` to the request's context, and it will pass to the next hop. + ctx := context.WithValue(r.Context(), Input, input) + next.ServeHTTP(rw, r.WithContext(ctx)) + }) } - e.tree = tree - return nil } -func (e *Engine) getErrorHandler() ErrorHandler { - if e.errorHandler != nil { - return e.errorHandler +// ReplaceDefaultErrorHandler replaces the default error handler with the given +// custom error handler. The default error handler will be used in the http.Handler +// that decoreated by the middleware created by NewInput(). +func ReplaceDefaultErrorHandler(custom ErrorHandler) { + if custom == nil { + panic(fmt.Errorf("httpin: %w", ErrNilErrorHandler)) } - - return globalCustomErrorHandler + globalCustomErrorHandler = custom } -func copyEngineCore(engine *Engine) *Engine { - return &Engine{ - inputType: engine.inputType, - tree: engine.tree, +func defaultErrorHandler(rw http.ResponseWriter, r *http.Request, err error) { + var invalidFieldError *InvalidFieldError + if errors.As(err, &invalidFieldError) { + rw.Header().Add("Content-Type", "application/json") + rw.WriteHeader(http.StatusUnprocessableEntity) // status: 422 + json.NewEncoder(rw).Encode(invalidFieldError) + return } + + http.Error(rw, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) // status: 500 } diff --git a/vendor/github.com/ggicci/httpin/internal/decoders.go b/vendor/github.com/ggicci/httpin/internal/decoders.go deleted file mode 100644 index 0a0b6398..00000000 --- a/vendor/github.com/ggicci/httpin/internal/decoders.go +++ /dev/null @@ -1,189 +0,0 @@ -package internal - -import ( - "fmt" - "mime/multipart" - "reflect" - "strconv" - "time" -) - -type ValueTypeDecoder interface { - Decode(value string) (interface{}, error) -} - -type FileTypeDecoder interface { - Decode(file *multipart.FileHeader) (interface{}, error) -} - -type ValueTypeDecoderFunc func(string) (interface{}, error) -type FileTypeDecoderFunc func(*multipart.FileHeader) (interface{}, error) - -// Decode calls fn(data). -func (fn ValueTypeDecoderFunc) Decode(value string) (interface{}, error) { - return fn(value) -} - -func (fn FileTypeDecoderFunc) Decode(file *multipart.FileHeader) (interface{}, error) { - return fn(file) -} - -var builtinDecoders = map[reflect.Type]interface{}{ - reflect.TypeOf(true): ValueTypeDecoderFunc(DecodeBool), - reflect.TypeOf(int(0)): ValueTypeDecoderFunc(DecodeInt), - reflect.TypeOf(int8(0)): ValueTypeDecoderFunc(DecodeInt8), - reflect.TypeOf(int16(0)): ValueTypeDecoderFunc(DecodeInt16), - reflect.TypeOf(int32(0)): ValueTypeDecoderFunc(DecodeInt32), - reflect.TypeOf(int64(0)): ValueTypeDecoderFunc(DecodeInt64), - reflect.TypeOf(uint(0)): ValueTypeDecoderFunc(DecodeUint), - reflect.TypeOf(uint8(0)): ValueTypeDecoderFunc(DecodeUint8), - reflect.TypeOf(uint16(0)): ValueTypeDecoderFunc(DecodeUint16), - reflect.TypeOf(uint32(0)): ValueTypeDecoderFunc(DecodeUint32), - reflect.TypeOf(uint64(0)): ValueTypeDecoderFunc(DecodeUint64), - reflect.TypeOf(float32(0.0)): ValueTypeDecoderFunc(DecodeFloat32), - reflect.TypeOf(float64(0.0)): ValueTypeDecoderFunc(DecodeFloat64), - reflect.TypeOf(complex64(0 + 1i)): ValueTypeDecoderFunc(DecodeComplex64), - reflect.TypeOf(complex128(0 + 1i)): ValueTypeDecoderFunc(DecodeComplex128), - reflect.TypeOf(string("0")): ValueTypeDecoderFunc(DecodeString), - reflect.TypeOf(time.Now()): ValueTypeDecoderFunc(DecodeTime), -} - -func DecoderOf(t reflect.Type) interface{} { - return builtinDecoders[t] -} - -func DecodeBool(value string) (interface{}, error) { - return strconv.ParseBool(value) -} - -func DecodeInt(value string) (interface{}, error) { - v, err := strconv.ParseInt(value, 10, 64) - if err != nil { - return nil, err - } - return int(v), nil -} - -func DecodeInt8(value string) (interface{}, error) { - v, err := strconv.ParseInt(value, 10, 8) - if err != nil { - return nil, err - } - return int8(v), nil -} -func DecodeInt16(value string) (interface{}, error) { - v, err := strconv.ParseInt(value, 10, 16) - if err != nil { - return nil, err - } - return int16(v), nil -} -func DecodeInt32(value string) (interface{}, error) { - v, err := strconv.ParseInt(value, 10, 32) - if err != nil { - return nil, err - } - return int32(v), nil -} -func DecodeInt64(value string) (interface{}, error) { - v, err := strconv.ParseInt(value, 10, 64) - if err != nil { - return nil, err - } - return int64(v), nil -} - -func DecodeUint(value string) (interface{}, error) { - v, err := strconv.ParseUint(value, 10, 64) - if err != nil { - return nil, err - } - return uint(v), nil -} - -func DecodeUint8(value string) (interface{}, error) { - v, err := strconv.ParseUint(value, 10, 8) - if err != nil { - return nil, err - } - return uint8(v), nil -} -func DecodeUint16(value string) (interface{}, error) { - v, err := strconv.ParseUint(value, 10, 16) - if err != nil { - return nil, err - } - return uint16(v), nil -} -func DecodeUint32(value string) (interface{}, error) { - v, err := strconv.ParseUint(value, 10, 32) - if err != nil { - return nil, err - } - return uint32(v), nil -} -func DecodeUint64(value string) (interface{}, error) { - v, err := strconv.ParseUint(value, 10, 64) - if err != nil { - return nil, err - } - return uint64(v), nil -} - -func DecodeFloat32(value string) (interface{}, error) { - v, err := strconv.ParseFloat(value, 32) - if err != nil { - return nil, err - } - return float32(v), nil -} - -func DecodeFloat64(value string) (interface{}, error) { - v, err := strconv.ParseFloat(value, 64) - if err != nil { - return nil, err - } - return float64(v), nil -} - -func DecodeComplex64(value string) (interface{}, error) { - v, err := strconv.ParseComplex(value, 64) - if err != nil { - return nil, err - } - return complex64(v), nil -} - -func DecodeComplex128(value string) (interface{}, error) { - v, err := strconv.ParseComplex(value, 128) - if err != nil { - return nil, err - } - return complex128(v), nil -} - -func DecodeString(value string) (interface{}, error) { - return value, nil -} - -// DecodeTime parses data bytes as time.Time in UTC timezone. -// Supported formats of the data bytes are: -// 1. RFC3339Nano string, e.g. "2006-01-02T15:04:05-07:00" -// 2. Unix timestamp, e.g. "1136239445" -func DecodeTime(value string) (interface{}, error) { - // Try parsing value as RFC3339 format. - if t, err := time.Parse(time.RFC3339Nano, value); err == nil { - return t.UTC(), nil - } - - // Try parsing value as timestamp, both integer and float formats supported. - // e.g. "1618974933", "1618974933.284368". - if timestamp, err := strconv.ParseInt(value, 10, 64); err == nil { - return time.Unix(timestamp, 0).UTC(), nil - } - if timestamp, err := strconv.ParseFloat(value, 64); err == nil { - return time.Unix(0, int64(timestamp*float64(time.Second))).UTC(), nil - } - - return time.Time{}, fmt.Errorf("invalid time value") -} diff --git a/vendor/github.com/ggicci/httpin/middleware.go b/vendor/github.com/ggicci/httpin/middleware.go deleted file mode 100644 index 404185a7..00000000 --- a/vendor/github.com/ggicci/httpin/middleware.go +++ /dev/null @@ -1,62 +0,0 @@ -package httpin - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "net/http" -) - -var ( - globalCustomErrorHandler ErrorHandler = defaultErrorHandler -) - -type middleware = func(http.Handler) http.Handler -type ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) - -// NewInput creates a "Middleware Constructor" for making a chain, which acts as -// a list of http.Handler constructors. We recommend using -// https://github.com/justinas/alice to chain your HTTP middleware functions and -// the app handler. -func NewInput(inputStruct interface{}, opts ...Option) middleware { - engine, err := New(inputStruct, opts...) - if err != nil { - panic(err) - } - - return func(next http.Handler) http.Handler { - return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - // Here we read the request and decode it to fill our structure. - // Once failed, the request should end here. - input, err := engine.Decode(r) - if err != nil { - engine.getErrorHandler()(rw, r, err) - return - } - - // We put the `input` to the request's context, and it will pass to the next hop. - ctx := context.WithValue(r.Context(), Input, input) - next.ServeHTTP(rw, r.WithContext(ctx)) - }) - } -} - -func ReplaceDefaultErrorHandler(custom ErrorHandler) { - if custom == nil { - panic(fmt.Errorf("httpin: %w", ErrNilErrorHandler)) - } - globalCustomErrorHandler = custom -} - -func defaultErrorHandler(rw http.ResponseWriter, r *http.Request, err error) { - var invalidFieldError *InvalidFieldError - if errors.As(err, &invalidFieldError) { - rw.Header().Add("Content-Type", "application/json") - rw.WriteHeader(http.StatusUnprocessableEntity) // status: 422 - json.NewEncoder(rw).Encode(invalidFieldError) - return - } - - http.Error(rw, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) // status: 500 -} diff --git a/vendor/github.com/ggicci/httpin/options.go b/vendor/github.com/ggicci/httpin/option.go similarity index 51% rename from vendor/github.com/ggicci/httpin/options.go rename to vendor/github.com/ggicci/httpin/option.go index c6f204bb..4309ec5e 100644 --- a/vendor/github.com/ggicci/httpin/options.go +++ b/vendor/github.com/ggicci/httpin/option.go @@ -1,10 +1,10 @@ package httpin -type Option func(*Engine) error +type Option func(*Core) error // WithErrorHandler overrides the default error handler. func WithErrorHandler(custom ErrorHandler) Option { - return func(c *Engine) error { + return func(c *Core) error { if custom == nil { return ErrNilErrorHandler } @@ -17,7 +17,7 @@ func WithErrorHandler(custom ErrorHandler) Option { // the request body. See https://pkg.go.dev/net/http#Request.ParseMultipartForm // for more details. func WithMaxMemory(maxMemory int64) Option { - return func(c *Engine) error { + return func(c *Core) error { if maxMemory < minimumMaxMemory { return ErrMaxMemoryTooSmall } @@ -25,16 +25,3 @@ func WithMaxMemory(maxMemory int64) Option { return nil } } - -// WithTypeDecoder overrides the default type decoder. -// The decoder can be type of ValueTypeDecoder or FileTypeDecoder. -// func WithTypeDecoder(typ reflect.Type, decoder interface{}) Option { -// ensureValidDecoder(typ, decoder) -// return func(c *Engine) error { -// if c.typeDecoders == nil { -// c.typeDecoders = make(map[reflect.Type]interface{}) -// } -// c.typeDecoders[typ] = decoder -// return nil -// } -// } diff --git a/vendor/github.com/ggicci/httpin/owl.go b/vendor/github.com/ggicci/httpin/owl.go new file mode 100644 index 00000000..8c1c888e --- /dev/null +++ b/vendor/github.com/ggicci/httpin/owl.go @@ -0,0 +1,7 @@ +package httpin + +import "github.com/ggicci/owl" + +func init() { + owl.UseTag("in") +} diff --git a/vendor/github.com/ggicci/httpin/patch.go b/vendor/github.com/ggicci/httpin/patch.go new file mode 100644 index 00000000..aa23a3f4 --- /dev/null +++ b/vendor/github.com/ggicci/httpin/patch.go @@ -0,0 +1,20 @@ +package httpin + +import ( + "reflect" + "strings" +) + +func isPatchField(t reflect.Type) bool { + return t.Kind() == reflect.Struct && + t.PkgPath() == "github.com/ggicci/httpin/patch" && + strings.HasPrefix(t.Name(), "Field[") +} + +func patchFieldElemType(t reflect.Type) (reflect.Type, bool) { + fv, _ := t.FieldByName("Value") + if fv.Type.Kind() == reflect.Slice { + return fv.Type.Elem(), true + } + return fv.Type, false +} diff --git a/vendor/github.com/ggicci/httpin/query.go b/vendor/github.com/ggicci/httpin/query.go index 3733ed22..bedbdbb0 100644 --- a/vendor/github.com/ggicci/httpin/query.go +++ b/vendor/github.com/ggicci/httpin/query.go @@ -3,14 +3,18 @@ package httpin -import "mime/multipart" +import ( + "mime/multipart" + "net/http" +) // queryValueExtractor implements the "query" executor who extracts values from // the querystring of an HTTP request. -func queryValueExtractor(ctx *DirectiveContext) error { +func queryValueExtractor(ctx *DirectiveRuntime) error { + req := ctx.Context.Value(RequestValue).(*http.Request) extractor := &extractor{ Form: multipart.Form{ - Value: ctx.Request.URL.Query(), + Value: req.URL.Query(), }, } return extractor.Execute(ctx) diff --git a/vendor/github.com/ggicci/httpin/required.go b/vendor/github.com/ggicci/httpin/required.go index c7978089..fdaf5183 100644 --- a/vendor/github.com/ggicci/httpin/required.go +++ b/vendor/github.com/ggicci/httpin/required.go @@ -6,7 +6,7 @@ package httpin // required implements the "required" executor who indicates that the field // must be set. If the field value were not set by former executors, error // `ErrMissingField` will be returned. -func required(ctx *DirectiveContext) error { +func required(ctx *DirectiveRuntime) error { if ctx.Context.Value(FieldSet) == nil { return ErrMissingField } diff --git a/vendor/github.com/ggicci/httpin/resolver.go b/vendor/github.com/ggicci/httpin/resolver.go deleted file mode 100644 index 5b1b0560..00000000 --- a/vendor/github.com/ggicci/httpin/resolver.go +++ /dev/null @@ -1,212 +0,0 @@ -package httpin - -import ( - "context" - "errors" - "fmt" - "net/http" - "reflect" - "strings" -) - -type fieldResolver struct { - Type reflect.Type - Field reflect.StructField - Path []string - Directives []*Directive - Fields []*fieldResolver - - decoder interface{} // passed in by defining a "decoder" directive -} - -func (r *fieldResolver) decoderOf(t reflect.Type) interface{} { - if r.decoder != nil { - return r.decoder - } - return decoderOf(t) -} - -func (r *fieldResolver) isBodyDecoderAnnotation() bool { - return r.Type == bodyTypeAnnotationJSON || r.Type == bodyTypeAnnotationXML -} - -func (r *fieldResolver) resolve(req *http.Request) (reflect.Value, error) { - rv := reflect.New(r.Type) - - // Then execute directives. - if len(r.Directives) > 0 { - inheritableContext := context.Background() - for _, dir := range r.Directives { - directiveContext := &DirectiveContext{ - Directive: *dir, - Request: req, - ValueType: r.Type, - Value: rv, - Context: inheritableContext, - - resolver: r, - } - if err := dir.Execute(directiveContext); err != nil { - var ( - fe fieldError - gotValue interface{} - ) - - if errors.As(err, &fe) { - gotValue = fe.Value - } - - return rv, &InvalidFieldError{ - Field: r.Field.Name, - Source: dir.Executor, - Value: gotValue, - internalError: err, - ErrorMessage: err.Error(), - Directives: r.Directives, - } - } - inheritableContext = directiveContext.Context - } - - // When all directives got executed, check context value of "StopRecursion" - // to determine whether we should resolve the "children fields" further. - if stopRecusrion, ok := inheritableContext.Value(StopRecursion).(bool); ok && stopRecusrion { - return rv, nil - } - } - - if len(r.Fields) > 0 { // struct - for i, fr := range r.Fields { - if fr.Field.PkgPath != "" { - continue // skip unexported field - } - - field, err := fr.resolve(req) - if err != nil { - return rv, err - } - rv.Elem().Field(i).Set(field.Elem()) - } - } - - return rv, nil -} - -func (r *fieldResolver) setDirectives(directives []*Directive) error { - var newDirectives []*Directive - for _, directive := range directives { - if directive.isDecoderSpecifier() { // decoder directive -> decoder - if len(directive.Argv) == 0 { - return ErrMissingDecoderName - } - // directive.Argv[0] should be the name of the decoder to set for the specific field. - decoder := decoderByName(directive.Argv[0]) - if decoder == nil { - return ErrDecoderNotFound - } - r.decoder = decoder - } else { - newDirectives = append(newDirectives, directive) - } - } - r.Directives = newDirectives - return nil -} - -// buildResolverTree builds a tree of resolvers for the specified struct type. -// Which helps resolving fields data from input sources. -func buildResolverTree(t reflect.Type) (*fieldResolver, error) { - root := &fieldResolver{Type: t} - - var typeOfBody reflect.Type - for i := 0; i < t.NumField(); i++ { - fieldResolver, err := buildFieldResolver(root, t.Field(i)) - if err != nil { - return nil, err - } - - // Check if there's a body decoder annotation field. - if fieldResolver.isBodyDecoderAnnotation() { - if typeOfBody != nil { - return nil, fmt.Errorf("%w: %s", ErrDuplicateAnnotationField, fieldResolver.Field.Name) - } - - // Inject a "body" directive to the root. - typeOfBody = fieldResolver.Type - dir, _ := buildDirective(fmt.Sprintf("body=%s", bodyTypeString(typeOfBody))) - _ = root.setDirectives([]*Directive{dir}) // error is ignored - } - - root.Fields = append(root.Fields, fieldResolver) - } - - return root, nil -} - -func buildFieldResolver(parent *fieldResolver, field reflect.StructField) (*fieldResolver, error) { - t := field.Type - path := make([]string, len(parent.Path)+1) - copy(path, parent.Path) - path[len(path)-1] = field.Name - - root := &fieldResolver{ - Type: t, - Field: field, - Path: path, - Directives: make([]*Directive, 0), - } - - // Skip parsing struct tags if met body resolver annotation field. - if root.isBodyDecoderAnnotation() { - return root, nil - } - - // Parse the struct tag and build the directives. - if directives, err := parseStructTag(field); err != nil { - return nil, fmt.Errorf("parse struct tag failed: %w", err) - } else { - if err := root.setDirectives(directives); err != nil { - return nil, fmt.Errorf("parse struct tag failed: %w", err) - } - } - - if field.Anonymous && t.Kind() == reflect.Struct && len(root.Directives) == 0 { - for i := 0; i < t.NumField(); i++ { - fieldResolver, err := buildFieldResolver(root, t.Field(i)) - if err != nil { - return nil, err - } - root.Fields = append(root.Fields, fieldResolver) - } - } - - return root, nil -} - -// parseStructTag parses and builds a resolver for a field by inspecting the struct tag. -// The tag named "in" will be extracted by httpin. -// Example contents of the `in` tag: -// - `in:"query=name"` -// - `in:"query=access_token,token;header=x-api-token"` -// Which should conform to the format: -// -// := "[;...[;]]" -// := [=[,...[,]]] -// -// For short, use `;` as directions' delimiter, use `,` as arguments' delimiter. -func parseStructTag(field reflect.StructField) ([]*Directive, error) { - directives := make([]*Directive, 0) - inTag := field.Tag.Get("in") - if inTag == "" { - return directives, nil // skip - } - for _, key := range strings.Split(inTag, ";") { - directive, err := buildDirective(key) - if err != nil { - return nil, err - } - directives = append(directives, directive) - } - - return directives, nil -} diff --git a/vendor/github.com/ggicci/owl/.gitignore b/vendor/github.com/ggicci/owl/.gitignore new file mode 100644 index 00000000..66fd13c9 --- /dev/null +++ b/vendor/github.com/ggicci/owl/.gitignore @@ -0,0 +1,15 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ diff --git a/vendor/github.com/ggicci/owl/LICENSE b/vendor/github.com/ggicci/owl/LICENSE new file mode 100644 index 00000000..f9a68ac8 --- /dev/null +++ b/vendor/github.com/ggicci/owl/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ggicci + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/ggicci/owl/Makefile b/vendor/github.com/ggicci/owl/Makefile new file mode 100644 index 00000000..91e2b293 --- /dev/null +++ b/vendor/github.com/ggicci/owl/Makefile @@ -0,0 +1,19 @@ +default: build + +GO=go +GOTEST=$(GO) test +GOCOVER=$(GO) tool cover + +build: + $(GO) build + +.PHONY: test +test: test/cover test/report + +.PHONY: test/cover +test/cover: + $(GOTEST) -v -race -failfast -parallel 4 -cpu 4 -coverprofile main.cover.out ./... + +.PHONY: test/report +test/report: + $(GOCOVER) -html=main.cover.out \ No newline at end of file diff --git a/vendor/github.com/ggicci/owl/README.md b/vendor/github.com/ggicci/owl/README.md new file mode 100644 index 00000000..e8489e30 --- /dev/null +++ b/vendor/github.com/ggicci/owl/README.md @@ -0,0 +1,8 @@ +# Owl + +Owl is a Go package that provides algorithmic guidance through structured directives using Go struct tags. + +[![Go](https://github.com/ggicci/owl/actions/workflows/go.yaml/badge.svg)](https://github.com/ggicci/owl/actions/workflows/go.yaml) +[![codecov](https://codecov.io/gh/ggicci/owl/graph/badge.svg?token=YU7FGGOY60)](https://codecov.io/gh/ggicci/owl) +[![Go Report Card](https://goreportcard.com/badge/github.com/ggicci/owl)](https://goreportcard.com/report/github.com/ggicci/owl) +[![Go Reference](https://pkg.go.dev/badge/github.com/ggicci/owl.svg)](https://pkg.go.dev/github.com/ggicci/owl) diff --git a/vendor/github.com/ggicci/owl/context.go b/vendor/github.com/ggicci/owl/context.go new file mode 100644 index 00000000..28dd1699 --- /dev/null +++ b/vendor/github.com/ggicci/owl/context.go @@ -0,0 +1,7 @@ +package owl + +type contextKey int + +const ( + ckNamespace contextKey = iota +) diff --git a/vendor/github.com/ggicci/owl/directive.go b/vendor/github.com/ggicci/owl/directive.go new file mode 100644 index 00000000..f3187d06 --- /dev/null +++ b/vendor/github.com/ggicci/owl/directive.go @@ -0,0 +1,110 @@ +package owl + +import ( + "context" + "reflect" + "regexp" + "strings" +) + +var reDirectiveName = regexp.MustCompile(`^[a-zA-Z0-9_]+$`) + +// Directive defines the profile to locate a `DirectiveExecutor` instance +// and drives it with essential arguments. +type Directive struct { + Name string // name of the executor + Argv []string // argv +} + +// NewDirective creates a Directive instance. +func NewDirective(name string, argv ...string) *Directive { + return &Directive{ + Name: name, + Argv: argv, + } +} + +// ParseDirective creates a Directive instance by parsing a directive string +// extracted from the struct tag. +// +// Example directives are: +// +// "form=page,page_index" -> { Name: "form", Args: ["page", "page_index"] } +// "header=x-api-token" -> { Name: "header", Args: ["x-api-token"] } +func ParseDirective(directive string) (*Directive, error) { + directive = strings.TrimSpace(directive) + parts := strings.SplitN(directive, "=", 2) + name := parts[0] + var argv []string + if len(parts) == 2 { + // Split the remained string by delimiter `,` as argv. + // NOTE: the whiltespaces are kept here. + // e.g. "query=page, index" -> { Name: "query", Args: ["page", " index"] } + argv = strings.Split(parts[1], ",") + } + + if !isValidDirectiveName(name) { + return nil, invalidDirectiveName(name) + } + + return NewDirective(name, argv...), nil +} + +func isValidDirectiveName(name string) bool { + return reDirectiveName.MatchString(name) +} + +// DirectiveExecutor is the interface that wraps the Execute method. +// Execute executes the directive by passing the runtime context. +type DirectiveExecutor interface { + Execute(*DirectiveRuntime) error +} + +// DirecrtiveExecutorFunc is an adapter to allow the use of ordinary functions +// as DirectiveExecutors. +type DirectiveExecutorFunc func(*DirectiveRuntime) error + +func (f DirectiveExecutorFunc) Execute(de *DirectiveRuntime) error { + return f(de) +} + +// DirectiveRuntime is the execution runtime/context of a directive. NOTE: the +// Directive and Resolver are both exported for the convenience but in an unsafe +// way. The user should not modify them. If you want to modify them, please call +// Resolver.Iterate to iterate the resolvers and modify them in the callback. +// And make sure this be done before any callings to Resolver.Resolve. +type DirectiveRuntime struct { + Directive *Directive + Resolver *Resolver + + // Value is the reflect.Value of the field that the directive is applied to. + // Worth noting that the value is a pointer to the field value. Which means + // if the field is of type int. Then Value is of type *int. And the actual + // value is stored in Value.Elem().Int(). The same for other types. So if you + // want to modify the field value, you should call Value.Elem().Set(value), + // e.g. Value.Elem().SetString(value), Value.Elem().SetInt(value), etc. + Value reflect.Value + + // Context is the runtime context of the directive execution. The initial + // context can be tweaked by applying options to Resolver.Resolve method. + // Use WithValue option to set a value to the initial context. Each field + // resolver will creates a new context by copying this initial context. And + // for the directives of the same field resolver, they will use the same + // context. Latter directives can use the values set by the former + // directives. Ex: + // + // type User struct { + // Name string `owl:"dirA;dirB"` // Context_1 + // Gender string `owl:"dirC"` // Context_2 + // } + // + // New(User{}).Resolve(WithValue("color", "red")) // Context_0 + // + // In the above example, the initial context is Context_0. It has a value of "color" set to "red". + // The context of the first field resolver is Context_1. It is created by copying Context_0. + // The context of the second field resolver is Context_2. It is also created by copying Context_0. + // Thus, all the directives during execution can access the value of "color" in Context_0. + // For the Name field resolver, it has two directives, dirA and dirB. They will use the same context Context_1. + // and if in dirA we set a value of "foo" to "bar", then in dirB we can get the value of "foo" as "bar". + Context context.Context +} diff --git a/vendor/github.com/ggicci/owl/errors.go b/vendor/github.com/ggicci/owl/errors.go new file mode 100644 index 00000000..94bf0533 --- /dev/null +++ b/vendor/github.com/ggicci/owl/errors.go @@ -0,0 +1,75 @@ +package owl + +import ( + "errors" + "fmt" +) + +var ( + ErrUnsupportedType = errors.New("unsupported type") + ErrInvalidDirectiveName = errors.New("invalid directive name") + ErrDuplicateDirective = errors.New("duplicate directive") + ErrMissingExecutor = errors.New("missing executor") + ErrTypeMismatch = errors.New("type mismatch") + ErrScanNilField = errors.New("scan nil field") +) + +func invalidDirectiveName(name string) error { + return fmt.Errorf("%w: %q (should comply with %s)", ErrInvalidDirectiveName, name, reDirectiveName.String()) +} + +func duplicateDirective(name string) error { + return fmt.Errorf("%w: %q (defined in the same struct tag)", ErrDuplicateDirective, name) +} + +func duplicateExecutor(name string) error { + return fmt.Errorf("duplicate executor: %q (registered to the same namespace)", name) +} + +func nilExecutor(name string) error { + return fmt.Errorf("nil executor: %q", name) +} + +type ResolveError struct { + fieldError +} + +func (e *ResolveError) Error() string { + return fmt.Sprintf("resolve field %q failed: %s", e.Resolver.String(), e.Err) +} + +type ScanError struct { + fieldError +} + +func (e *ScanError) Error() string { + return fmt.Sprintf("scan field %q failed: %s", e.Resolver.String(), e.Err) +} + +type fieldError struct { + Err error + Resolver *Resolver +} + +func (e *fieldError) Unwrap() error { + return e.Err +} + +func (e *fieldError) AsDirectiveExecutionError() *DirectiveExecutionError { + var de *DirectiveExecutionError + errors.As(e.Err, &de) + return de +} + +type DirectiveExecutionError struct { + Err error + Directive +} + +func (e *DirectiveExecutionError) Error() string { + return fmt.Sprintf("execute directive %q with args %v failed: %s", e.Directive.Name, e.Directive.Argv, e.Err) +} + +func (e *DirectiveExecutionError) Unwrap() error { + return e.Err +} diff --git a/vendor/github.com/ggicci/owl/namespace.go b/vendor/github.com/ggicci/owl/namespace.go new file mode 100644 index 00000000..06898811 --- /dev/null +++ b/vendor/github.com/ggicci/owl/namespace.go @@ -0,0 +1,53 @@ +package owl + +import "fmt" + +var ( + defaultNS = NewNamespace() +) + +// RegisterDirectiveExecutor registers a named executor globally, i.e. to the default +// namespace. +func RegisterDirectiveExecutor(name string, exe DirectiveExecutor, replace ...bool) { + defaultNS.RegisterDirectiveExecutor(name, exe, replace...) +} + +// LookupExecutor returns the executor by name globally (from the default +// namespace). +func LookupExecutor(name string) DirectiveExecutor { + return defaultNS.LookupExecutor(name) +} + +// Namespace isolates the executors as a collection. +type Namespace struct { + executors map[string]DirectiveExecutor +} + +// NewNamespace creates a new namespace. Which is a collection of executors. +func NewNamespace() *Namespace { + return &Namespace{ + executors: make(map[string]DirectiveExecutor), + } +} + +// RegisterDirectiveExecutor registers a named executor to the namespace. The executor +// should implement the DirectiveExecutor interface. Will panic if the name were taken +// or the executor is nil. Pass replace (true) to ignore the name conflict. +func (ns *Namespace) RegisterDirectiveExecutor(name string, exe DirectiveExecutor, replace ...bool) { + force := len(replace) > 0 && replace[0] + if _, ok := ns.executors[name]; ok && !force { + panic(fmt.Errorf("owl: %s", duplicateExecutor(name))) + } + if exe == nil { + panic(fmt.Errorf("owl: %s", nilExecutor(name))) + } + if !isValidDirectiveName(name) { + panic(fmt.Errorf("owl: %s", invalidDirectiveName(name))) + } + ns.executors[name] = exe +} + +// LookupExecutor returns the executor by name. +func (ns *Namespace) LookupExecutor(name string) DirectiveExecutor { + return ns.executors[name] +} diff --git a/vendor/github.com/ggicci/owl/option.go b/vendor/github.com/ggicci/owl/option.go new file mode 100644 index 00000000..33855840 --- /dev/null +++ b/vendor/github.com/ggicci/owl/option.go @@ -0,0 +1,23 @@ +package owl + +import "context" + +type Option interface { + Apply(context.Context) context.Context +} + +type OptionFunc func(context.Context) context.Context + +func (f OptionFunc) Apply(ctx context.Context) context.Context { + return f(ctx) +} + +func WithValue(key, value interface{}) Option { + return OptionFunc(func(ctx context.Context) context.Context { + return context.WithValue(ctx, key, value) + }) +} + +func WithNamespace(ns *Namespace) Option { + return WithValue(ckNamespace, ns) +} diff --git a/vendor/github.com/ggicci/owl/owl.go b/vendor/github.com/ggicci/owl/owl.go new file mode 100644 index 00000000..a6606bef --- /dev/null +++ b/vendor/github.com/ggicci/owl/owl.go @@ -0,0 +1,7 @@ +// Package "owl" a go struct tag framework and algorithm driver. +// It provides algorithmic guidance through structured directives +// using Go struct tags. Users can design their own directives +// and register them to owl. Owl will run the directives on +// the struct fields in a depth-first manner. Which means it is +// suitable for data-binding algorithms, data validations, etc. +package owl diff --git a/vendor/github.com/ggicci/owl/resolver.go b/vendor/github.com/ggicci/owl/resolver.go new file mode 100644 index 00000000..3e0a2dac --- /dev/null +++ b/vendor/github.com/ggicci/owl/resolver.go @@ -0,0 +1,463 @@ +package owl + +import ( + "context" + "errors" + "fmt" + "reflect" + "strconv" + "strings" + "sync" +) + +// Saves all the built resolver trees without applying options. +// The key is the struct type. +var builtTrees sync.Map + +// Resolver is a field resolver. Which is a node in the resolver tree. +// The resolver tree is built from a struct value. Each node represents a +// field in the struct. The root node represents the struct itself. +// It is used to resolve a field value from a data source. +type Resolver struct { + Type reflect.Type + Field reflect.StructField + Index []int + Path []string + Directives []*Directive + Parent *Resolver + Children []*Resolver + Context context.Context // save custom resolver settings here +} + +// New builds a resolver tree from a struct value. The given options will be +// applied to all the resolvers. In the resolver tree, each node is also a +// Resolver. +func New(structValue interface{}, opts ...Option) (*Resolver, error) { + typ, err := reflectStructType(structValue) + if err != nil { + return nil, err + } + + tree, err := buildAndCacheResolverTree(typ) + if err != nil { + return nil, err + } + tree = tree.copy() + + // Apply options, build the context for each resolver. + defaultOpts := []Option{WithNamespace(defaultNS)} + opts = append(defaultOpts, opts...) + ctx := context.Background() + for _, opt := range opts { + ctx = opt.Apply(ctx) + } + + // Apply the context to each resolver. + tree.Iterate(func(r *Resolver) error { + r.Context = ctx + return nil + }) + + // Validate the tree. + if err := tree.validate(); err != nil { + return nil, err + } + + return tree, nil +} + +func (r *Resolver) copy() *Resolver { + resolverCopy := new(Resolver) + *resolverCopy = *r + resolverCopy.Context = context.Background() + + // Copy the children. + resolverCopy.Children = make([]*Resolver, len(r.Children)) + for i, child := range r.Children { + resolverCopy.Children[i] = child.copy() + resolverCopy.Children[i].Parent = resolverCopy + } + return resolverCopy +} + +func (r *Resolver) validate() error { + if r.Namespace() == nil { + return errors.New("nil namespace") + } + + return nil +} + +func (r *Resolver) IsRoot() bool { + return r.Parent == nil +} + +func (r *Resolver) IsLeaf() bool { + return len(r.Children) == 0 +} + +func (r *Resolver) PathString() string { + return strings.Join(r.Path, ".") +} + +func (r *Resolver) GetDirective(name string) *Directive { + for _, d := range r.Directives { + if d.Name == name { + return d + } + } + return nil +} + +func (r *Resolver) RemoveDirective(name string) *Directive { + for i, d := range r.Directives { + if d.Name == name { + r.Directives = append(r.Directives[:i], r.Directives[i+1:]...) + return d + } + } + return nil +} + +func (r *Resolver) Namespace() *Namespace { + return r.Context.Value(ckNamespace).(*Namespace) +} + +// Find finds a field resolver by path. e.g. "Pagination.Page", "User.Name", etc. +func (r *Resolver) Lookup(path string) *Resolver { + var paths []string + if path != "" { + paths = strings.Split(path, ".") + } + return findResolver(r, paths) +} + +func findResolver(root *Resolver, path []string) *Resolver { + if len(path) == 0 { + return root + } + + for _, field := range root.Children { + if field.Field.Name == path[0] { + return findResolver(field, path[1:]) + } + } + + return nil +} + +func (r *Resolver) String() string { + return fmt.Sprintf("%s (%v)", r.PathString(), r.Type) +} + +// Iterate visits the resolver tree by depth-first. The callback function +// will be called for each field resolver. If the callback returns an error, +// the iteration will be stopped. +func (r *Resolver) Iterate(fn func(*Resolver) error) error { + return iterateResolverTree(r, fn) +} + +func iterateResolverTree(root *Resolver, fn func(*Resolver) error) error { + if err := fn(root); err != nil { + return err + } + + for _, field := range root.Children { + if err := iterateResolverTree(field, fn); err != nil { + return err + } + } + + return nil +} + +// Scan scans the struct value by traversing the fields in depth-first order. The value is required +// to have the same type as the resolver holds. While scanning, it will run the directives on each +// field. The DirectiveRuntime that can be accessed during the directive exeuction will have its +// Value property populated with reflect.Value of the field. Typically, Scan is used to do some +// readonly operations against the struct value, e.g. validate the struct value, build something +// based on the struct value, etc. +// +// Use WithValue to create an Option that can add custom values to the context, the context can be +// used by the directive executors during the resolution. +// +// NOTE: Unlike Resolve, it will iterate the whole resolver tree against the given +// value, try to access each corresponding field. Even scan fails on one of the fields, +// it will continue to scan the rest of the fields. The returned error can be a +// multi-error combined by errors.Join, which contains all the errors that occurred +// during the scan. +func (r *Resolver) Scan(value any, opts ...Option) error { + if value == nil { + return fmt.Errorf("cannot scan nil value") + } + + rv := reflect.ValueOf(value) + if rv.Kind() == reflect.Ptr { + rv = rv.Elem() + } + if rv.Type() != r.Type { + return fmt.Errorf("%w: cannot scan value of type %q, expecting type %q", + ErrTypeMismatch, rv.Type(), r.Type) + } + + ctx := context.Background() + for _, opt := range opts { + ctx = opt.Apply(ctx) + } + + var errs []error + r.Iterate(func(r *Resolver) error { + errs = append(errs, scan(r, ctx, rv)) + return nil + }) + + return errors.Join(errs...) +} + +func scan(resolver *Resolver, ctx context.Context, rootValue reflect.Value) error { + if resolver.IsRoot() { + return nil // skip on root, which is the root struct itself + } + + // Get the field value this resolver points to. + fv, err := rootValue.FieldByIndexErr(resolver.Index) + if err != nil { + return &ScanError{ + fieldError: fieldError{ + Err: fmt.Errorf("%w: %v", ErrScanNilField, err), + Resolver: resolver, + }, + } + } + + // Run directives on the field. + if err := resolver.runDirectives(ctx, fv); err != nil { + return &ScanError{ + fieldError: fieldError{ + Err: err, + Resolver: resolver, + }, + } + } + + return nil +} + +// Resolve resolves the struct type by traversing the tree in depth-first order. Typically it is +// used to create a new struct instance by reading from some data source. This method always creates +// a new value of the type the resolver holds. And runs the directives on each field. +// +// Use WithValue to create an Option that can add custom values to the context, the context can be +// used by the directive executors during the resolution. Example: +// +// type Settings struct { +// DarkMode bool `owl:"env=MY_APP_DARK_MODE;cfg=appearance.dark_mode;default=false"` +// } +// resolver := owl.New(Settings{}) +// settings, err := resolver.Resolve(WithValue("app_config", appConfig)) +// +// NOTE: while iterating the tree, if resolving a field fails, the iteration will be +// stopped and the error will be returned. +func (r *Resolver) Resolve(opts ...Option) (reflect.Value, error) { + ctx := context.Background() + for _, opt := range opts { + ctx = opt.Apply(ctx) + } + rootValue := reflect.New(r.Type) + return rootValue, r.resolve(ctx, rootValue) +} + +func (root *Resolver) resolve(ctx context.Context, rootValue reflect.Value) error { + // Run the directives on current field. + if err := root.runDirectives(ctx, rootValue); err != nil { + return err + } + + // Resolve the children fields. + if len(root.Children) > 0 { + // If the root is a pointer, we need to allocate memory for it. + // We only expect it's a one-level pointer, e.g. *User, not **User. + underlyingValue := rootValue + if root.Type.Kind() == reflect.Ptr { + underlyingValue = reflect.New(root.Type.Elem()) + rootValue.Elem().Set(underlyingValue) + } + + for _, child := range root.Children { + if err := child.resolve(ctx, underlyingValue.Elem().Field(child.Index[len(child.Index)-1]).Addr()); err != nil { + return &ResolveError{ + fieldError: fieldError{ + Err: err, + Resolver: child, + }, + } + } + } + } + return nil +} + +func (r *Resolver) runDirectives(ctx context.Context, rv reflect.Value) error { + ns := r.Namespace() + + // The namespace can be overriden by calling Scan/Resolve with WithNamespace. + if nsOverriden := ctx.Value(ckNamespace); nsOverriden != nil { + ns = nsOverriden.(*Namespace) + } + + for _, directive := range r.Directives { + dirRuntime := &DirectiveRuntime{ + Directive: directive, + Resolver: r, + Context: ctx, + Value: rv, + } + exe := ns.LookupExecutor(directive.Name) + if exe == nil { + return &DirectiveExecutionError{ + Err: ErrMissingExecutor, + Directive: *directive, + } + } + + if err := exe.Execute(dirRuntime); err != nil { + return &DirectiveExecutionError{ + Err: err, + Directive: *directive, + } + } + + ctx = dirRuntime.Context // make the context available to the next directive + } + + return nil +} + +func (r *Resolver) DebugLayoutText(depth int) string { + var sb strings.Builder + sb.WriteString(r.String()) + sb.WriteString(fmt.Sprintf(" %v", r.Index)) + + for i, field := range r.Children { + sb.WriteString("\n") + sb.WriteString(strings.Repeat(" ", depth+1)) + sb.WriteString(strconv.Itoa(i)) + sb.WriteString("# ") + sb.WriteString(field.DebugLayoutText(depth + 1)) + } + return sb.String() +} + +// buildAndCacheResolverTree returns the tree with minimum settings (without any +// options applied). It will load from cache if possible. Otherwise, it will +// build the tree from scratch and cache it. +func buildAndCacheResolverTree(typ reflect.Type) (tree *Resolver, err error) { + if builtTree, ok := builtTrees.Load(typ); ok { // hit cache + return builtTree.(*Resolver), nil + } + + tree, err = buildResolverTree(typ) // build from scratch + if err != nil { + return nil, err + } + + // Build successfully, cache it. + builtTrees.Store(typ, tree) + return tree, nil +} + +// buildResolverTree builds a resolver tree from a struct type. +func buildResolverTree(typ reflect.Type) (*Resolver, error) { + return buildResolver(typ, reflect.StructField{}, nil) +} + +func buildResolver(typ reflect.Type, field reflect.StructField, parent *Resolver) (*Resolver, error) { + root := &Resolver{ + Type: typ, + Field: field, + Index: []int{}, + Parent: parent, + Context: context.Background(), + } + + if !root.IsRoot() { + directives, err := parseDirectives(field.Tag.Get(Tag())) + if err != nil { + return nil, fmt.Errorf("parse directives: %w", err) + } + root.Directives = directives + root.Path = append(root.Parent.Path, field.Name) + root.Index = append(root.Parent.Index, field.Index...) + } + + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } + + if typ.Kind() == reflect.Struct { + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + + // Skip unexported fields. Because we can't set value to them, nor + // get value from them by reflection. + if !field.IsExported() { + continue + } + + child, err := buildResolver(field.Type, field, root) + if err != nil { + path := append(root.Path, field.Name) + return nil, fmt.Errorf("build resolver for %q failed: %w", strings.Join(path, "."), err) + } + + // Skip the field if it has no children and no directives. + if len(child.Children) > 0 || len(child.Directives) > 0 { + root.Children = append(root.Children, child) + } + } + } + return root, nil +} + +func reflectStructType(structValue interface{}) (reflect.Type, error) { + typ, ok := structValue.(reflect.Type) + if !ok { + typ = reflect.TypeOf(structValue) + } + + if typ == nil { + return nil, fmt.Errorf("%w: nil type", ErrUnsupportedType) + } + + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } + + if typ.Kind() != reflect.Struct { + return nil, fmt.Errorf("%w: non-struct type %v", ErrUnsupportedType, typ) + } + + return typ, nil +} + +func parseDirectives(tag string) ([]*Directive, error) { + tag = strings.TrimSpace(tag) + var directives []*Directive + existed := make(map[string]bool) + for _, directive := range strings.Split(tag, ";") { + directive = strings.TrimSpace(directive) + if directive == "" { + continue + } + d, err := ParseDirective(directive) + if err != nil { + return nil, err + } + if existed[d.Name] { + return nil, duplicateDirective(d.Name) + } + existed[d.Name] = true + directives = append(directives, d) + } + return directives, nil +} diff --git a/vendor/github.com/ggicci/owl/structtag.go b/vendor/github.com/ggicci/owl/structtag.go new file mode 100644 index 00000000..26b25229 --- /dev/null +++ b/vendor/github.com/ggicci/owl/structtag.go @@ -0,0 +1,15 @@ +package owl + +const DefaultTagName = "owl" + +var tagName string = DefaultTagName + +// UseTag sets the tag name to parse directives. +func UseTag(tag string) { + tagName = tag +} + +// Tag returns the tag name where the directives are parsed from. +func Tag() string { + return tagName +} diff --git a/vendor/github.com/go-playground/validator/v10/README.md b/vendor/github.com/go-playground/validator/v10/README.md index 8e80d52a..dbbafc3e 100644 --- a/vendor/github.com/go-playground/validator/v10/README.md +++ b/vendor/github.com/go-playground/validator/v10/README.md @@ -1,7 +1,7 @@ Package validator ================= [![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -![Project status](https://img.shields.io/badge/version-10.15.4-green.svg) +![Project status](https://img.shields.io/badge/version-10.16.0-green.svg) [![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator) [![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator) @@ -178,6 +178,7 @@ validate := validator.New(validator.WithRequiredStructEnabled()) | isbn | International Standard Book Number | | isbn10 | International Standard Book Number 10 | | isbn13 | International Standard Book Number 13 | +| issn | International Standard Serial Number | | iso3166_1_alpha2 | Two-letter country code (ISO 3166-1 alpha-2) | | iso3166_1_alpha3 | Three-letter country code (ISO 3166-1 alpha-3) | | iso3166_1_alpha_numeric | Numeric country code (ISO 3166-1 numeric) | diff --git a/vendor/github.com/go-playground/validator/v10/baked_in.go b/vendor/github.com/go-playground/validator/v10/baked_in.go index 0b623307..95f56e00 100644 --- a/vendor/github.com/go-playground/validator/v10/baked_in.go +++ b/vendor/github.com/go-playground/validator/v10/baked_in.go @@ -51,6 +51,7 @@ var ( endKeysTag: {}, structOnlyTag: {}, omitempty: {}, + omitnil: {}, skipValidationTag: {}, utf8HexComma: {}, utf8Pipe: {}, @@ -149,6 +150,7 @@ var ( "isbn": isISBN, "isbn10": isISBN10, "isbn13": isISBN13, + "issn": isISSN, "eth_addr": isEthereumAddress, "eth_addr_checksum": isEthereumAddressChecksum, "btc_addr": isBitcoinAddress, @@ -508,47 +510,47 @@ func isASCII(fl FieldLevel) bool { // isUUID5 is the validation function for validating if the field's value is a valid v5 UUID. func isUUID5(fl FieldLevel) bool { - return uUID5Regex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uUID5Regex, fl) } // isUUID4 is the validation function for validating if the field's value is a valid v4 UUID. func isUUID4(fl FieldLevel) bool { - return uUID4Regex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uUID4Regex, fl) } // isUUID3 is the validation function for validating if the field's value is a valid v3 UUID. func isUUID3(fl FieldLevel) bool { - return uUID3Regex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uUID3Regex, fl) } // isUUID is the validation function for validating if the field's value is a valid UUID of any version. func isUUID(fl FieldLevel) bool { - return uUIDRegex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uUIDRegex, fl) } // isUUID5RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v5 UUID. func isUUID5RFC4122(fl FieldLevel) bool { - return uUID5RFC4122Regex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uUID5RFC4122Regex, fl) } // isUUID4RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v4 UUID. func isUUID4RFC4122(fl FieldLevel) bool { - return uUID4RFC4122Regex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uUID4RFC4122Regex, fl) } // isUUID3RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v3 UUID. func isUUID3RFC4122(fl FieldLevel) bool { - return uUID3RFC4122Regex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uUID3RFC4122Regex, fl) } // isUUIDRFC4122 is the validation function for validating if the field's value is a valid RFC4122 UUID of any version. func isUUIDRFC4122(fl FieldLevel) bool { - return uUIDRFC4122Regex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uUIDRFC4122Regex, fl) } // isULID is the validation function for validating if the field's value is a valid ULID. func isULID(fl FieldLevel) bool { - return uLIDRegex.MatchString(fl.Field().String()) + return fieldMatchesRegexByStringerValOrString(uLIDRegex, fl) } // isMD4 is the validation function for validating if the field's value is a valid MD4. @@ -650,6 +652,32 @@ func isISBN10(fl FieldLevel) bool { return checksum%11 == 0 } +// isISSN is the validation function for validating if the field's value is a valid ISSN. +func isISSN(fl FieldLevel) bool { + s := fl.Field().String() + + if !iSSNRegex.MatchString(s) { + return false + } + s = strings.ReplaceAll(s, "-", "") + + pos := 8 + checksum := 0 + + for i := 0; i < 7; i++ { + checksum += pos * int(s[i]-'0') + pos-- + } + + if s[7] == 'X' { + checksum += 10 + } else { + checksum += int(s[7] - '0') + } + + return checksum%11 == 0 +} + // isEthereumAddress is the validation function for validating if the field's value is a valid Ethereum address. func isEthereumAddress(fl FieldLevel) bool { address := fl.Field().String() @@ -1413,6 +1441,15 @@ func isURI(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } +// isFileURL is the helper function for validating if the `path` valid file URL as per RFC8089 +func isFileURL(path string) bool { + if !strings.HasPrefix(path, "file:/") { + return false + } + _, err := url.ParseRequestURI(path) + return err == nil +} + // isURL is the validation function for validating if the current field's value is a valid URL. func isURL(fl FieldLevel) bool { field := fl.Field() @@ -1420,12 +1457,16 @@ func isURL(fl FieldLevel) bool { switch field.Kind() { case reflect.String: - s := field.String() + s := strings.ToLower(field.String()) if len(s) == 0 { return false } + if isFileURL(s) { + return true + } + url, err := url.Parse(s) if err != nil || url.Scheme == "" { return false diff --git a/vendor/github.com/go-playground/validator/v10/cache.go b/vendor/github.com/go-playground/validator/v10/cache.go index bbfd2a4a..0f4fa6b5 100644 --- a/vendor/github.com/go-playground/validator/v10/cache.go +++ b/vendor/github.com/go-playground/validator/v10/cache.go @@ -20,6 +20,7 @@ const ( typeOr typeKeys typeEndKeys + typeOmitNil ) const ( @@ -252,6 +253,10 @@ func (v *Validate) parseFieldTagsRecursive(tag string, fieldName string, alias s current.typeof = typeOmitEmpty continue + case omitnil: + current.typeof = typeOmitNil + continue + case structOnlyTag: current.typeof = typeStructOnly continue diff --git a/vendor/github.com/go-playground/validator/v10/doc.go b/vendor/github.com/go-playground/validator/v10/doc.go index c4dbb595..b4740918 100644 --- a/vendor/github.com/go-playground/validator/v10/doc.go +++ b/vendor/github.com/go-playground/validator/v10/doc.go @@ -194,6 +194,13 @@ such as min or max won't run, but if a value is set validation will run. Usage: omitempty +# Omit Nil + +Allows to skip the validation if the value is nil (same as omitempty, but +only for the nil-values). + + Usage: omitnil + # Dive This tells the validator to dive into a slice, array or map and validate that diff --git a/vendor/github.com/go-playground/validator/v10/regexes.go b/vendor/github.com/go-playground/validator/v10/regexes.go index 6c8f9856..af98d8da 100644 --- a/vendor/github.com/go-playground/validator/v10/regexes.go +++ b/vendor/github.com/go-playground/validator/v10/regexes.go @@ -22,6 +22,7 @@ const ( base64RawURLRegexString = "^(?:[A-Za-z0-9-_]{4})*(?:[A-Za-z0-9-_]{2,4})$" iSBN10RegexString = "^(?:[0-9]{9}X|[0-9]{10})$" iSBN13RegexString = "^(?:(?:97(?:8|9))[0-9]{10})$" + iSSNRegexString = "^(?:[0-9]{4}-[0-9]{3}[0-9X])$" uUID3RegexString = "^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$" uUID4RegexString = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" uUID5RegexString = "^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" @@ -93,6 +94,7 @@ var ( base64RawURLRegex = regexp.MustCompile(base64RawURLRegexString) iSBN10Regex = regexp.MustCompile(iSBN10RegexString) iSBN13Regex = regexp.MustCompile(iSBN13RegexString) + iSSNRegex = regexp.MustCompile(iSSNRegexString) uUID3Regex = regexp.MustCompile(uUID3RegexString) uUID4Regex = regexp.MustCompile(uUID4RegexString) uUID5Regex = regexp.MustCompile(uUID5RegexString) diff --git a/vendor/github.com/go-playground/validator/v10/util.go b/vendor/github.com/go-playground/validator/v10/util.go index 4bd947bd..16851593 100644 --- a/vendor/github.com/go-playground/validator/v10/util.go +++ b/vendor/github.com/go-playground/validator/v10/util.go @@ -1,7 +1,9 @@ package validator import ( + "fmt" "reflect" + "regexp" "strconv" "strings" "time" @@ -292,3 +294,18 @@ func panicIf(err error) { panic(err.Error()) } } + +// Checks if field value matches regex. If fl.Field can be cast to Stringer, it uses the Stringer interfaces +// String() return value. Otherwise, it uses fl.Field's String() value. +func fieldMatchesRegexByStringerValOrString(regex *regexp.Regexp, fl FieldLevel) bool { + switch fl.Field().Kind() { + case reflect.String: + return regex.MatchString(fl.Field().String()) + default: + if stringer, ok := fl.Field().Interface().(fmt.Stringer); ok { + return regex.MatchString(stringer.String()) + } else { + return regex.MatchString(fl.Field().String()) + } + } +} diff --git a/vendor/github.com/go-playground/validator/v10/validator.go b/vendor/github.com/go-playground/validator/v10/validator.go index 342c4ec2..a072d39c 100644 --- a/vendor/github.com/go-playground/validator/v10/validator.go +++ b/vendor/github.com/go-playground/validator/v10/validator.go @@ -112,6 +112,10 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr return } + if ct.typeof == typeOmitNil && (kind != reflect.Invalid && current.IsNil()) { + return + } + if ct.hasTag { if kind == reflect.Invalid { v.str1 = string(append(ns, cf.altName...)) @@ -233,6 +237,26 @@ OUTER: ct = ct.next continue + case typeOmitNil: + v.slflParent = parent + v.flField = current + v.cf = cf + v.ct = ct + + switch field := v.Field(); field.Kind() { + case reflect.Slice, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Func: + if field.IsNil() { + return + } + default: + if v.fldIsPointer && field.Interface() == nil { + return + } + } + + ct = ct.next + continue + case typeEndKeys: return diff --git a/vendor/github.com/go-playground/validator/v10/validator_instance.go b/vendor/github.com/go-playground/validator/v10/validator_instance.go index a4dbdd09..d5a7be1d 100644 --- a/vendor/github.com/go-playground/validator/v10/validator_instance.go +++ b/vendor/github.com/go-playground/validator/v10/validator_instance.go @@ -22,6 +22,7 @@ const ( structOnlyTag = "structonly" noStructLevelTag = "nostructlevel" omitempty = "omitempty" + omitnil = "omitnil" isdefault = "isdefault" requiredWithoutAllTag = "required_without_all" requiredWithoutTag = "required_without" diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s index db9171c2..269e173c 100644 --- a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s +++ b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/cpu/cpu_aix.go b/vendor/golang.org/x/sys/cpu/cpu_aix.go index 8aaeef54..9bf0c32e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_aix.go +++ b/vendor/golang.org/x/sys/cpu/cpu_aix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix -// +build aix package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.s index c61f95a0..fcb9a388 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.s +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go index ccf542a7..a8acd3e3 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go index 0af2f248..c8ae6ddc 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go index fa7cdb9b..910728fb 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gc -// +build 386 amd64 amd64p32 -// +build gc package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go index 2aff3189..7f194678 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo -// +build gccgo package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go index 4bfbda61..9526d2ce 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo -// +build gccgo package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c index 6cc73109..3f73a05d 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gccgo -// +build 386 amd64 amd64p32 -// +build gccgo #include #include diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go index 863d415a..99c60fe9 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gccgo -// +build 386 amd64 amd64p32 -// +build gccgo package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux.go b/vendor/golang.org/x/sys/cpu/cpu_linux.go index 159a686f..743eb543 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !386 && !amd64 && !amd64p32 && !arm64 -// +build !386,!amd64,!amd64p32,!arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go index 6000db4c..4686c1d5 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) -// +build linux -// +build mips64 mips64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go index f4992b1a..cd63e733 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x -// +build linux,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le,!s390x package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go index 021356d6..197188e6 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) -// +build linux -// +build ppc64 ppc64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_loong64.go b/vendor/golang.org/x/sys/cpu/cpu_loong64.go index 0f57b05b..55863585 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_loong64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_loong64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build loong64 -// +build loong64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go index f4063c66..fedb00cc 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build mips64 || mips64le -// +build mips64 mips64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go index 07c4e36d..ffb4ec7e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go +++ b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build mips || mipsle -// +build mips mipsle package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go index d7b4fb4c..e9ecf2a4 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && arm -// +build !linux,arm package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go index f3cde129..5341e7f8 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && !netbsd && !openbsd && arm64 -// +build !linux,!netbsd,!openbsd,arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go index 0dafe964..5f8f2419 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && (mips64 || mips64le) -// +build !linux -// +build mips64 mips64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go index 060d46b6..89608fba 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !linux && (ppc64 || ppc64le) -// +build !aix -// +build !linux -// +build ppc64 ppc64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go index dd10eb79..5ab87808 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && riscv64 -// +build !linux,riscv64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go index 4e8acd16..c14f12b1 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build ppc64 || ppc64le -// +build ppc64 ppc64le package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go index ff7da60e..7f0c79c0 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 -// +build riscv64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.s b/vendor/golang.org/x/sys/cpu/cpu_s390x.s index 96f81e20..1fb4b701 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_s390x.s +++ b/vendor/golang.org/x/sys/cpu/cpu_s390x.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/cpu/cpu_wasm.go b/vendor/golang.org/x/sys/cpu/cpu_wasm.go index 7747d888..384787ea 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_wasm.go +++ b/vendor/golang.org/x/sys/cpu/cpu_wasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build wasm -// +build wasm package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go index 2dcde828..c29f5e4c 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 || amd64 || amd64p32 -// +build 386 amd64 amd64p32 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.s b/vendor/golang.org/x/sys/cpu/cpu_x86.s index 39acab2f..7d7ba33e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.s +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gc -// +build 386 amd64 amd64p32 -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/cpu/endian_big.go b/vendor/golang.org/x/sys/cpu/endian_big.go index 93ce03a3..7fe04b0a 100644 --- a/vendor/golang.org/x/sys/cpu/endian_big.go +++ b/vendor/golang.org/x/sys/cpu/endian_big.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 -// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/endian_little.go b/vendor/golang.org/x/sys/cpu/endian_little.go index 55db853e..48eccc4c 100644 --- a/vendor/golang.org/x/sys/cpu/endian_little.go +++ b/vendor/golang.org/x/sys/cpu/endian_little.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh || wasm -// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh wasm package cpu diff --git a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go index d87bd6b3..4cd64c70 100644 --- a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go +++ b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && arm64 -// +build linux,arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go b/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go index b975ea2a..4c9788ea 100644 --- a/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go +++ b/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.21 -// +build go1.21 package cpu diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go index 96134157..1b9ccb09 100644 --- a/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go +++ b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go @@ -9,7 +9,6 @@ // gccgo's libgo and thus must not used a CGo method. //go:build aix && gccgo -// +build aix,gccgo package cpu diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go index 904be42f..e8b6cdbe 100644 --- a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go @@ -7,7 +7,6 @@ // (See golang.org/issue/32102) //go:build aix && ppc64 && gc -// +build aix,ppc64,gc package cpu diff --git a/vendor/golang.org/x/sys/unix/aliases.go b/vendor/golang.org/x/sys/unix/aliases.go index abc89c10..e7d3df4b 100644 --- a/vendor/golang.org/x/sys/unix/aliases.go +++ b/vendor/golang.org/x/sys/unix/aliases.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9 -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos -// +build go1.9 package unix diff --git a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s index db9171c2..269e173c 100644 --- a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s +++ b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_386.s b/vendor/golang.org/x/sys/unix/asm_bsd_386.s index e0fcd9b3..a4fcef0e 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_386.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_386.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (freebsd || netbsd || openbsd) && gc -// +build freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s index 2b99c349..1e63615c 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc -// +build darwin dragonfly freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_arm.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s index d702d4ad..6496c310 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (freebsd || netbsd || openbsd) && gc -// +build freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s index fe36a739..4fd1f54d 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s b/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s index e5b9a848..42f7eb9e 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s b/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s index d560019e..f8902667 100644 --- a/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s index 8fd101d0..3b473487 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_386.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_386.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s index 7ed38e43..67e29f31 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s index 8ef1d514..d6ae269c 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s index 98ae0276..01e5e253 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && arm64 && gc -// +build linux -// +build arm64 -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s index 56535728..2abf12f6 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && loong64 && gc -// +build linux -// +build loong64 -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s index 21231d2c..f84bae71 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) && gc -// +build linux -// +build mips64 mips64le -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s index 6783b26c..f08f6280 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips || mipsle) && gc -// +build linux -// +build mips mipsle -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s index 19d49893..bdfc024d 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) && gc -// +build linux -// +build ppc64 ppc64le -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s index e42eb81d..2e8c9961 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && gc -// +build riscv64 -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s index c46aab33..2c394b11 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && s390x && gc -// +build linux -// +build s390x -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s index 5e7a1169..fab586a2 100644 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s index f8c5394c..f949ec54 100644 --- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s index 3b54e185..2f67ba86 100644 --- a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s +++ b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x && gc -// +build zos -// +build s390x -// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/cap_freebsd.go b/vendor/golang.org/x/sys/unix/cap_freebsd.go index 0b7c6adb..a0865789 100644 --- a/vendor/golang.org/x/sys/unix/cap_freebsd.go +++ b/vendor/golang.org/x/sys/unix/cap_freebsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build freebsd -// +build freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go index 394a3965..6fb7cb77 100644 --- a/vendor/golang.org/x/sys/unix/constants.go +++ b/vendor/golang.org/x/sys/unix/constants.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go index 65a99850..d7851346 100644 --- a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc -// +build aix,ppc // Functions to access/create device major and minor numbers matching the // encoding used by AIX. diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go index 8fc08ad0..623a5e69 100644 --- a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc64 -// +build aix,ppc64 // Functions to access/create device major and minor numbers matching the // encoding used AIX. diff --git a/vendor/golang.org/x/sys/unix/dev_zos.go b/vendor/golang.org/x/sys/unix/dev_zos.go index a388e59a..bb6a64fe 100644 --- a/vendor/golang.org/x/sys/unix/dev_zos.go +++ b/vendor/golang.org/x/sys/unix/dev_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Functions to access/create device major and minor numbers matching the // encoding used by z/OS. diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go index 2499f977..1ebf1178 100644 --- a/vendor/golang.org/x/sys/unix/dirent.go +++ b/vendor/golang.org/x/sys/unix/dirent.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/endian_big.go b/vendor/golang.org/x/sys/unix/endian_big.go index a5202655..1095fd31 100644 --- a/vendor/golang.org/x/sys/unix/endian_big.go +++ b/vendor/golang.org/x/sys/unix/endian_big.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 -// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 package unix diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go index b0f2bc4a..b9f0e277 100644 --- a/vendor/golang.org/x/sys/unix/endian_little.go +++ b/vendor/golang.org/x/sys/unix/endian_little.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh -// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh package unix diff --git a/vendor/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go index 29ccc4d1..a96da71f 100644 --- a/vendor/golang.org/x/sys/unix/env_unix.go +++ b/vendor/golang.org/x/sys/unix/env_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Unix environment variables. diff --git a/vendor/golang.org/x/sys/unix/epoll_zos.go b/vendor/golang.org/x/sys/unix/epoll_zos.go index cedaf7e0..7753fdde 100644 --- a/vendor/golang.org/x/sys/unix/epoll_zos.go +++ b/vendor/golang.org/x/sys/unix/epoll_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go index e9b99125..58c6bfc7 100644 --- a/vendor/golang.org/x/sys/unix/fcntl.go +++ b/vendor/golang.org/x/sys/unix/fcntl.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build dragonfly || freebsd || linux || netbsd || openbsd -// +build dragonfly freebsd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go index 29d44808..13b4acd5 100644 --- a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go +++ b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc) -// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/fdset.go b/vendor/golang.org/x/sys/unix/fdset.go index a8068f94..9e83d18c 100644 --- a/vendor/golang.org/x/sys/unix/fdset.go +++ b/vendor/golang.org/x/sys/unix/fdset.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/fstatfs_zos.go b/vendor/golang.org/x/sys/unix/fstatfs_zos.go index e377cc9f..c8bde601 100644 --- a/vendor/golang.org/x/sys/unix/fstatfs_zos.go +++ b/vendor/golang.org/x/sys/unix/fstatfs_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go index b06f52d7..aca5721d 100644 --- a/vendor/golang.org/x/sys/unix/gccgo.go +++ b/vendor/golang.org/x/sys/unix/gccgo.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && !aix && !hurd -// +build gccgo,!aix,!hurd package unix diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c index f98a1c54..d468b7b4 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_c.c +++ b/vendor/golang.org/x/sys/unix/gccgo_c.c @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && !aix && !hurd -// +build gccgo,!aix,!hurd #include #include diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go index e60e49a3..972d61bd 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && linux && amd64 -// +build gccgo,linux,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go index 15721a51..848840ae 100644 --- a/vendor/golang.org/x/sys/unix/ifreq_linux.go +++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux -// +build linux package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_signed.go b/vendor/golang.org/x/sys/unix/ioctl_signed.go index 7def9580..5b0759bd 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_signed.go +++ b/vendor/golang.org/x/sys/unix/ioctl_signed.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || solaris -// +build aix solaris package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_unsigned.go b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go index 649913d1..20f470b9 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_unsigned.go +++ b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd -// +build darwin dragonfly freebsd hurd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_zos.go b/vendor/golang.org/x/sys/unix/ioctl_zos.go index cdc21bf7..c8b2a750 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_zos.go +++ b/vendor/golang.org/x/sys/unix/ioctl_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 47fa6a7e..cbe24150 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -663,7 +663,6 @@ echo '// mkerrors.sh' "$@" echo '// Code generated by the command above; see README.md. DO NOT EDIT.' echo echo "//go:build ${GOARCH} && ${GOOS}" -echo "// +build ${GOARCH},${GOOS}" echo go tool cgo -godefs -- "$@" _const.go >_error.out cat _error.out | grep -vf _error.grep | grep -vf _signal.grep diff --git a/vendor/golang.org/x/sys/unix/mmap_nomremap.go b/vendor/golang.org/x/sys/unix/mmap_nomremap.go index ca051363..4b68e597 100644 --- a/vendor/golang.org/x/sys/unix/mmap_nomremap.go +++ b/vendor/golang.org/x/sys/unix/mmap_nomremap.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || openbsd || solaris -// +build aix darwin dragonfly freebsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/mremap.go b/vendor/golang.org/x/sys/unix/mremap.go index fa93d0aa..fd45fe52 100644 --- a/vendor/golang.org/x/sys/unix/mremap.go +++ b/vendor/golang.org/x/sys/unix/mremap.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux || netbsd -// +build linux netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/pagesize_unix.go b/vendor/golang.org/x/sys/unix/pagesize_unix.go index 53f1b4c5..4d0a3430 100644 --- a/vendor/golang.org/x/sys/unix/pagesize_unix.go +++ b/vendor/golang.org/x/sys/unix/pagesize_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris // For Unix, get the pagesize from the runtime. diff --git a/vendor/golang.org/x/sys/unix/pledge_openbsd.go b/vendor/golang.org/x/sys/unix/pledge_openbsd.go index eb48294b..6a09af53 100644 --- a/vendor/golang.org/x/sys/unix/pledge_openbsd.go +++ b/vendor/golang.org/x/sys/unix/pledge_openbsd.go @@ -8,54 +8,31 @@ import ( "errors" "fmt" "strconv" - "syscall" - "unsafe" ) // Pledge implements the pledge syscall. // -// The pledge syscall does not accept execpromises on OpenBSD releases -// before 6.3. -// -// execpromises must be empty when Pledge is called on OpenBSD -// releases predating 6.3, otherwise an error will be returned. +// This changes both the promises and execpromises; use PledgePromises or +// PledgeExecpromises to only change the promises or execpromises +// respectively. // // For more information see pledge(2). func Pledge(promises, execpromises string) error { - maj, min, err := majmin() - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - err = pledgeAvailable(maj, min, execpromises) + pptr, err := BytePtrFromString(promises) if err != nil { return err } - pptr, err := syscall.BytePtrFromString(promises) + exptr, err := BytePtrFromString(execpromises) if err != nil { return err } - // This variable will hold either a nil unsafe.Pointer or - // an unsafe.Pointer to a string (execpromises). - var expr unsafe.Pointer - - // If we're running on OpenBSD > 6.2, pass execpromises to the syscall. - if maj > 6 || (maj == 6 && min > 2) { - exptr, err := syscall.BytePtrFromString(execpromises) - if err != nil { - return err - } - expr = unsafe.Pointer(exptr) - } - - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0) - if e != 0 { - return e - } - - return nil + return pledge(pptr, exptr) } // PledgePromises implements the pledge syscall. @@ -64,30 +41,16 @@ func Pledge(promises, execpromises string) error { // // For more information see pledge(2). func PledgePromises(promises string) error { - maj, min, err := majmin() - if err != nil { - return err - } - - err = pledgeAvailable(maj, min, "") - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - // This variable holds the execpromises and is always nil. - var expr unsafe.Pointer - - pptr, err := syscall.BytePtrFromString(promises) + pptr, err := BytePtrFromString(promises) if err != nil { return err } - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0) - if e != 0 { - return e - } - - return nil + return pledge(pptr, nil) } // PledgeExecpromises implements the pledge syscall. @@ -96,30 +59,16 @@ func PledgePromises(promises string) error { // // For more information see pledge(2). func PledgeExecpromises(execpromises string) error { - maj, min, err := majmin() - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - err = pledgeAvailable(maj, min, execpromises) + exptr, err := BytePtrFromString(execpromises) if err != nil { return err } - // This variable holds the promises and is always nil. - var pptr unsafe.Pointer - - exptr, err := syscall.BytePtrFromString(execpromises) - if err != nil { - return err - } - - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0) - if e != 0 { - return e - } - - return nil + return pledge(nil, exptr) } // majmin returns major and minor version number for an OpenBSD system. @@ -147,16 +96,15 @@ func majmin() (major int, minor int, err error) { // pledgeAvailable checks for availability of the pledge(2) syscall // based on the running OpenBSD version. -func pledgeAvailable(maj, min int, execpromises string) error { - // If OpenBSD <= 5.9, pledge is not available. - if (maj == 5 && min != 9) || maj < 5 { - return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min) +func pledgeAvailable() error { + maj, min, err := majmin() + if err != nil { + return err } - // If OpenBSD <= 6.2 and execpromises is not empty, - // return an error - execpromises is not available before 6.3 - if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" { - return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min) + // Require OpenBSD 6.4 as a minimum. + if maj < 6 || (maj == 6 && min <= 3) { + return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj, min) } return nil diff --git a/vendor/golang.org/x/sys/unix/ptrace_darwin.go b/vendor/golang.org/x/sys/unix/ptrace_darwin.go index 463c3eff..3f0975f3 100644 --- a/vendor/golang.org/x/sys/unix/ptrace_darwin.go +++ b/vendor/golang.org/x/sys/unix/ptrace_darwin.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin && !ios -// +build darwin,!ios package unix diff --git a/vendor/golang.org/x/sys/unix/ptrace_ios.go b/vendor/golang.org/x/sys/unix/ptrace_ios.go index ed0509a0..a4d35db5 100644 --- a/vendor/golang.org/x/sys/unix/ptrace_ios.go +++ b/vendor/golang.org/x/sys/unix/ptrace_ios.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build ios -// +build ios package unix diff --git a/vendor/golang.org/x/sys/unix/race.go b/vendor/golang.org/x/sys/unix/race.go index 6f6c5fec..714d2aae 100644 --- a/vendor/golang.org/x/sys/unix/race.go +++ b/vendor/golang.org/x/sys/unix/race.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin && race) || (linux && race) || (freebsd && race) -// +build darwin,race linux,race freebsd,race package unix diff --git a/vendor/golang.org/x/sys/unix/race0.go b/vendor/golang.org/x/sys/unix/race0.go index 706e1322..4a9f6634 100644 --- a/vendor/golang.org/x/sys/unix/race0.go +++ b/vendor/golang.org/x/sys/unix/race0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos -// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos package unix diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdents.go b/vendor/golang.org/x/sys/unix/readdirent_getdents.go index 4d625756..dbd2b6cc 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdents.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdents.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || dragonfly || freebsd || linux || netbsd || openbsd -// +build aix dragonfly freebsd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go index 2a4ba47c..130398b6 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin -// +build darwin package unix diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go index 3865943f..c3a62dbb 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Socket control messages diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go index 0840fe4a..4a1eab37 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go index 63e8c838..5ea74da9 100644 --- a/vendor/golang.org/x/sys/unix/syscall.go +++ b/vendor/golang.org/x/sys/unix/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Package unix contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index e94e6cda..67ce6cef 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix -// +build aix // Aix system calls. // This file is compiled as ordinary Go code, @@ -107,7 +106,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go index f2871fa9..1fdaa476 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc -// +build aix,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go index 75718ec0..c87f9a9f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc64 -// +build aix,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 4217de51..6f328e3a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || netbsd || openbsd -// +build darwin dragonfly freebsd netbsd openbsd // BSD system call wrappers shared by *BSD based systems // including OS X (Darwin) and FreeBSD. Like the other diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index b37310ce..0eaecf5f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && darwin -// +build amd64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go index d51ec996..f36c6707 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && darwin -// +build arm64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go index 53c96641..16dc6993 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin && go1.12 -// +build darwin,go1.12 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go index 4e2d3212..14bab6b2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go index b8da5100..3967bca7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go index 47155c48..eff19ada 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go index 08932093..4f24b517 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go index d151a0d0..ac30759e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go index d5cd64b3..aab725ca 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd.go b/vendor/golang.org/x/sys/unix/syscall_hurd.go index 381fd467..ba46651f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_hurd.go +++ b/vendor/golang.org/x/sys/unix/syscall_hurd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build hurd -// +build hurd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd_386.go b/vendor/golang.org/x/sys/unix/syscall_hurd_386.go index 7cf54a3e..df89f9e6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_hurd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_hurd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && hurd -// +build 386,hurd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go index 87db5a6a..a863f705 100644 --- a/vendor/golang.org/x/sys/unix/syscall_illumos.go +++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go @@ -5,7 +5,6 @@ // illumos system calls not present on Solaris. //go:build amd64 && illumos -// +build amd64,illumos package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index fb4e5022..a5e1c10e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -417,7 +417,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- @@ -2482,3 +2483,5 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { } return attr, nil } + +//sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index c7d9945e..506dafa7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && linux -// +build 386,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go b/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go index 08086ac6..38d55641 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64) -// +build linux -// +build 386 amd64 mips mipsle mips64 mipsle ppc64 ppc64le ppc s390x sparc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 70601ce3..d557cf8d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && linux -// +build amd64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go index 8b0f0f3a..facdb83b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && linux && gc -// +build amd64,linux,gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index da298641..cd2dd797 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && linux -// +build arm,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index f5266689..cf2ee6c7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && linux -// +build arm64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go index 2b1168d7..ffc4c2b6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gc -// +build linux,gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go index 9843fb48..9ebfdcf4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gc && 386 -// +build linux,gc,386 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go index a6008fcc..5f2b57c4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && gc && linux -// +build arm,gc,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go index 7740af24..d1a3ad82 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gccgo && 386 -// +build linux,gccgo,386 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go index e16a1229..f2f67423 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gccgo && arm -// +build linux,gccgo,arm package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go index f6ab02ec..3d0e9845 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build loong64 && linux -// +build loong64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 93fe59d2..70963a95 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) -// +build linux -// +build mips64 mips64le package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index aae7f0ff..c218ebd2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips || mipsle) -// +build linux -// +build mips mipsle package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go index 66eff19a..e6c48500 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && ppc -// +build linux,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 806aa257..7286a9aa 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) -// +build linux -// +build ppc64 ppc64le package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 5e6ceee1..6f5a2889 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && linux -// +build riscv64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index 2f89e8f5..66f31210 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build s390x && linux -// +build s390x,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index 7ca064ae..11d1f169 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build sparc64 && linux -// +build sparc64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go index 5199d282..7a5eb574 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go index 70a9c52e..62d8957a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go index 3eb5942f..ce6a0688 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go index fc6ccfd8..d46d689d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 6f34479b..d2882ee0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -137,18 +137,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { - var _p0 unsafe.Pointer + var bufptr *Statfs_t var bufsize uintptr if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) + bufptr = &buf[0] bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) } - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = e1 - } - return + return getfsstat(bufptr, bufsize, flags) } //sysnb getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) @@ -326,4 +321,7 @@ func Uname(uname *Utsname) error { //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) +//sys getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) +//sys pledge(promises *byte, execpromises *byte) (err error) +//sys unveil(path *byte, flags *byte) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go index 6baabcdc..9ddc89f4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go index bab25360..70a3c96e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go index 8eed3c4d..265caa87 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go index 483dde99..ac4fda17 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go index 04aa43f4..0a451e6d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build openbsd -// +build openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go index c2796139..30a308cb 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go index 23199a7f..ea954330 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index b99cfa13..60c8142d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -128,7 +128,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go index 0bd25ef8..e02d8cea 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && solaris -// +build amd64,solaris package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index f6eda270..77081de8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go index b6919ca5..05c95bcc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc -// +build darwin dragonfly freebsd linux,!ppc64,!ppc64le netbsd openbsd solaris -// +build gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go index f6f707ac..23f39b7a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64le || ppc64) && gc -// +build linux -// +build ppc64le ppc64 -// +build gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index 4596d041..d99d05f1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/sysvshm_linux.go b/vendor/golang.org/x/sys/unix/sysvshm_linux.go index 2c3a4437..4fcd38de 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_linux.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux -// +build linux package unix diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go index 5bb41d17..79a84f18 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin && !ios) || linux -// +build darwin,!ios linux package unix diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go index 71bddefd..9eb0db66 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin && !ios -// +build darwin,!ios package unix diff --git a/vendor/golang.org/x/sys/unix/timestruct.go b/vendor/golang.org/x/sys/unix/timestruct.go index 616b1b28..7997b190 100644 --- a/vendor/golang.org/x/sys/unix/timestruct.go +++ b/vendor/golang.org/x/sys/unix/timestruct.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/unveil_openbsd.go b/vendor/golang.org/x/sys/unix/unveil_openbsd.go index 168d5ae7..cb7e598c 100644 --- a/vendor/golang.org/x/sys/unix/unveil_openbsd.go +++ b/vendor/golang.org/x/sys/unix/unveil_openbsd.go @@ -4,39 +4,48 @@ package unix -import ( - "syscall" - "unsafe" -) +import "fmt" // Unveil implements the unveil syscall. // For more information see unveil(2). // Note that the special case of blocking further // unveil calls is handled by UnveilBlock. func Unveil(path string, flags string) error { - pathPtr, err := syscall.BytePtrFromString(path) - if err != nil { + if err := supportsUnveil(); err != nil { return err } - flagsPtr, err := syscall.BytePtrFromString(flags) + pathPtr, err := BytePtrFromString(path) if err != nil { return err } - _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) - if e != 0 { - return e + flagsPtr, err := BytePtrFromString(flags) + if err != nil { + return err } - return nil + return unveil(pathPtr, flagsPtr) } // UnveilBlock blocks future unveil calls. // For more information see unveil(2). func UnveilBlock() error { - // Both pointers must be nil. - var pathUnsafe, flagsUnsafe unsafe.Pointer - _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) - if e != 0 { - return e + if err := supportsUnveil(); err != nil { + return err } + return unveil(nil, nil) +} + +// supportsUnveil checks for availability of the unveil(2) system call based +// on the running OpenBSD version. +func supportsUnveil() error { + maj, min, err := majmin() + if err != nil { + return err + } + + // unveil is not available before 6.4 + if maj < 6 || (maj == 6 && min <= 3) { + return fmt.Errorf("cannot call Unveil on OpenBSD %d.%d", maj, min) + } + return nil } diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go index f5f8e9f3..e1687939 100644 --- a/vendor/golang.org/x/sys/unix/xattr_bsd.go +++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build freebsd || netbsd -// +build freebsd netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go index ca9799b7..2fb219d7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && aix -// +build ppc,aix // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -maix32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go index 200c8c26..b0e6f5c8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && aix -// +build ppc64,aix // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -maix64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 14300762..e40fa852 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index ab044a74..bb02aa6c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index 17bba0e4..c0e0f869 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index f8c2c513..6c692390 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index 96310c3b..dd9163f8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index 777b69de..493a2a79 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go index c557ac2d..8b437b30 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go index 341b4d96..67c02dd5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index f9c7f479..9c00cbf5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -481,10 +480,14 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_AFTER = 0x10 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_KPROBE_MULTI_RETURN = 0x1 + BPF_F_BEFORE = 0x8 + BPF_F_ID = 0x20 + BPF_F_LINK = 0x2000 + BPF_F_NETFILTER_IP_DEFRAG = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REPLACE = 0x4 BPF_F_SLEEPABLE = 0x10 @@ -521,6 +524,7 @@ const ( BPF_MAJOR_VERSION = 0x1 BPF_MAXINSNS = 0x1000 BPF_MEM = 0x60 + BPF_MEMSX = 0x80 BPF_MEMWORDS = 0x10 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 @@ -776,6 +780,8 @@ const ( DEVLINK_GENL_MCGRP_CONFIG_NAME = "config" DEVLINK_GENL_NAME = "devlink" DEVLINK_GENL_VERSION = 0x1 + DEVLINK_PORT_FN_CAP_IPSEC_CRYPTO = 0x4 + DEVLINK_PORT_FN_CAP_IPSEC_PACKET = 0x8 DEVLINK_PORT_FN_CAP_MIGRATABLE = 0x2 DEVLINK_PORT_FN_CAP_ROCE = 0x1 DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14 @@ -1698,6 +1704,7 @@ const ( KEXEC_ON_CRASH = 0x1 KEXEC_PRESERVE_CONTEXT = 0x2 KEXEC_SEGMENT_MAX = 0x10 + KEXEC_UPDATE_ELFCOREHDR = 0x4 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CAPABILITIES = 0x1f KEYCTL_CAPS0_BIG_KEY = 0x10 @@ -2275,6 +2282,7 @@ const ( PERF_MEM_LVLNUM_PMEM = 0xe PERF_MEM_LVLNUM_RAM = 0xd PERF_MEM_LVLNUM_SHIFT = 0x21 + PERF_MEM_LVLNUM_UNC = 0x8 PERF_MEM_LVL_HIT = 0x2 PERF_MEM_LVL_IO = 0x1000 PERF_MEM_LVL_L1 = 0x8 @@ -3461,6 +3469,7 @@ const ( XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 + XDP_PKT_CONTD = 0x1 XDP_RING_NEED_WAKEUP = 0x1 XDP_RX_RING = 0x2 XDP_SHARED_UMEM = 0x1 @@ -3473,6 +3482,7 @@ const ( XDP_UMEM_REG = 0x4 XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1 XDP_USE_NEED_WAKEUP = 0x8 + XDP_USE_SG = 0x10 XDP_ZEROCOPY = 0x4 XENFS_SUPER_MAGIC = 0xabba1974 XFS_SUPER_MAGIC = 0x58465342 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 30aee00a..4920821c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/386/include -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 8ebfa512..a0c1e411 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/amd64/include -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 271a21cd..c6398556 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/arm/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 910c330a..47cc62e2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/arm64/include -fsigned-char _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index a640798c..27ac4a09 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/loong64/include _const.go @@ -119,6 +118,7 @@ const ( IXOFF = 0x1000 IXON = 0x400 LASX_CTX_MAGIC = 0x41535801 + LBT_CTX_MAGIC = 0x42540001 LSX_CTX_MAGIC = 0x53580001 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 0d5925d3..54694642 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index d72a00e0..3adb81d7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips64/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 02ba129f..2dfe98f0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips64le/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 8daa6dd9..f5398f84 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mipsle/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 63c8fa2f..c54f152d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 930799ec..76057dc7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 8605a7dd..e0c3725e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64le/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 95a016f1..18f2813e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/riscv64/include _const.go @@ -228,6 +227,9 @@ const ( PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff + PTRACE_GETFDPIC = 0x21 + PTRACE_GETFDPIC_EXEC = 0x0 + PTRACE_GETFDPIC_INTERP = 0x1 RLIMIT_AS = 0x9 RLIMIT_MEMLOCK = 0x8 RLIMIT_NOFILE = 0x7 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 1ae0108f..11619d4e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/s390x/include -fsigned-char _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 1bb7c633..396d994d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/sparc64/include _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go index 72f7420d..130085df 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go index 8d4eb0c0..84769a1a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go index 9eef9749..602ded00 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -marm _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go index 3b62ba19..efc0406e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index af20e474..5a6500f8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 6015fcb2..a5aeeb97 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index 8d44955e..0e9748a7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go index ae16fe75..4f4449ab 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go index 03d90fe3..76a363f0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go index 8e2c51b1..43ca0cdf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go index 13d40303..b1b8bb20 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go index 1afee6a0..d2ddd317 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && solaris -// +build amd64,solaris // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go index fc7d0506..4dfd2e05 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Hand edited based on zerrors_linux_s390x.go // TODO: auto-generate. diff --git a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go index 97f20ca2..586317c7 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT. //go:build linux && (arm || arm64) -// +build linux -// +build arm arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go index 0b5f7943..d7c881be 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mips", "mips64"). DO NOT EDIT. //go:build linux && (mips || mips64) -// +build linux -// +build mips mips64 package unix diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go index 2807f7e6..2d2de5d2 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mipsle", "mips64le"). DO NOT EDIT. //go:build linux && (mipsle || mips64le) -// +build linux -// +build mipsle mips64le package unix diff --git a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go index 281ea64e..5adc79fb 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("386", "amd64"). DO NOT EDIT. //go:build linux && (386 || amd64) -// +build linux -// +build 386 amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index d1d1d233..6ea64a3c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc -// +build aix,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index f99a18ad..99ee4399 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 -// +build aix,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index c4d50ae5..b68a7836 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 && gc -// +build aix,ppc64,gc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index 6903d3b0..0a87450b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 && gccgo -// +build aix,ppc64,gccgo package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 1cad561e..ccb02f24 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build darwin && amd64 -// +build darwin,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index b18edbd0..1b40b997 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build darwin && arm64 -// +build darwin,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 0c67df64..aad65fc7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build dragonfly && amd64 -// +build dragonfly,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index e6e05d14..c0096391 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && 386 -// +build freebsd,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 7508acca..7664df74 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && amd64 -// +build freebsd,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 7b56aead..ae099182 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && arm -// +build freebsd,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index cc623dca..11fd5d45 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && arm64 -// +build freebsd,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go index 58184919..c3d2d653 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && riscv64 -// +build freebsd,riscv64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go index 6be25cd1..c698cbc0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build illumos && amd64 -// +build illumos,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 1ff3aec7..faca7a55 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -2195,3 +2194,13 @@ func schedGetattr(pid int, attr *SchedAttr, size uint, flags uint) (err error) { } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) { + _, _, e1 := Syscall6(SYS_CACHESTAT, uintptr(fd), uintptr(unsafe.Pointer(crange)), uintptr(unsafe.Pointer(cstat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 07b549cc..4def3e9f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && 386 -// +build linux,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 5f481bf8..fef2bc8b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && amd64 -// +build linux,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 824cd52c..a9fd76a8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && arm -// +build linux,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index e77aecfe..46006502 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && arm64 -// +build linux,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go index 806ffd1e..c8987d26 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && loong64 -// +build linux,loong64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 961a3afb..921f4306 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips -// +build linux,mips package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index ed05005e..44f06782 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips64 -// +build linux,mips64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index d365b718..e7fa0abf 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips64le -// +build linux,mips64le package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index c3f1b8bb..8c512567 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mipsle -// +build linux,mipsle package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go index a6574cf9..7392fd45 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc -// +build linux,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index f4099026..41180434 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc64 -// +build linux,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 9dfcc299..40c6ce7a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc64le -// +build linux,ppc64le package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index 0ab4f2ed..2cfe34ad 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && riscv64 -// +build linux,riscv64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 6cde3223..61e6f070 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && s390x -// +build linux,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index 5253d65b..834b8420 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && sparc64 -// +build linux,sparc64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 2df3c5ba..e91ebc14 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && 386 -// +build netbsd,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index a60556ba..be28babb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && amd64 -// +build netbsd,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 9f788917..fb587e82 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && arm -// +build netbsd,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index 82a4cb2d..d576438b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && arm64 -// +build netbsd,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 66b3b645..88bfc288 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && 386 -// +build openbsd,386 package unix @@ -2213,6 +2212,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2243,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 3dcacd30..4cbeff17 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -668,7 +668,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL 路libc_munmap_trampoline_addr(SB), RODATA, $4 DATA 路libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL 路libc_getfsstat_trampoline_addr(SB), RODATA, $4 +DATA 路libc_getfsstat_trampoline_addr(SB)/4, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL 路libc_utimensat_trampoline_addr(SB), RODATA, $4 DATA 路libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL 路libc_pledge_trampoline_addr(SB), RODATA, $4 +DATA 路libc_pledge_trampoline_addr(SB)/4, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL 路libc_unveil_trampoline_addr(SB), RODATA, $4 +DATA 路libc_unveil_trampoline_addr(SB)/4, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index c5c4cc11..b8a67b99 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && amd64 -// +build openbsd,amd64 package unix @@ -2213,6 +2212,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2243,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 2763620b..1123f275 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -668,7 +668,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL 路libc_munmap_trampoline_addr(SB), RODATA, $8 DATA 路libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL 路libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA 路libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL 路libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA 路libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL 路libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA 路libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL 路libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA 路libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index 93bfbb32..af50a65c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && arm -// +build openbsd,arm package unix @@ -2213,6 +2212,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2243,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index c9223140..82badae3 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -668,7 +668,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL 路libc_munmap_trampoline_addr(SB), RODATA, $4 DATA 路libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL 路libc_getfsstat_trampoline_addr(SB), RODATA, $4 +DATA 路libc_getfsstat_trampoline_addr(SB)/4, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL 路libc_utimensat_trampoline_addr(SB), RODATA, $4 DATA 路libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL 路libc_pledge_trampoline_addr(SB), RODATA, $4 +DATA 路libc_pledge_trampoline_addr(SB)/4, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL 路libc_unveil_trampoline_addr(SB), RODATA, $4 +DATA 路libc_unveil_trampoline_addr(SB)/4, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index a107b8fd..8fb4ff36 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && arm64 -// +build openbsd,arm64 package unix @@ -2213,6 +2212,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2243,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index a6bc32c9..24d7eecb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -668,7 +668,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL 路libc_munmap_trampoline_addr(SB), RODATA, $8 DATA 路libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL 路libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA 路libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL 路libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA 路libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL 路libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA 路libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL 路libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA 路libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index c427de50..f469a83e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && mips64 -// +build openbsd,mips64 package unix @@ -2213,6 +2212,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2243,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index b4e7bcea..9a498a06 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -668,7 +668,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL 路libc_munmap_trampoline_addr(SB), RODATA, $8 DATA 路libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL 路libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA 路libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL 路libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA 路libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL 路libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA 路libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL 路libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA 路libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index 60c1a99a..c26ca2e1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && ppc64 -// +build openbsd,ppc64 package unix @@ -2213,6 +2212,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2243,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index ca3f7660..1f224aa4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -801,8 +801,26 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL 路libc_munmap_trampoline_addr(SB), RODATA, $8 DATA 路libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getfsstat(SB) + RET +GLOBL 路libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA 路libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_utimensat(SB) RET GLOBL 路libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA 路libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_pledge(SB) + RET +GLOBL 路libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA 路libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_unveil(SB) + RET +GLOBL 路libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA 路libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index 52eba360..bcc920dd 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && riscv64 -// +build openbsd,riscv64 package unix @@ -2213,6 +2212,21 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getfsstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2229,3 +2243,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" + + diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index 477a7d5b..87a79c70 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -668,7 +668,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL 路libc_munmap_trampoline_addr(SB), RODATA, $8 DATA 路libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL 路libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA 路libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL 路libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA 路libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL 路libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA 路libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL 路libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA 路libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index b4018946..829b87fe 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build solaris && amd64 -// +build solaris,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go index 1d8fe1d4..94f01123 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go index 55e04847..3a58ae81 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index d2243cf8..dcb7a0eb 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go index 82dc51bd..db5a7bf1 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go index cbdda1a4..7be575a7 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go index f55eae1a..d6e3174c 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go index e4405447..ee97157d 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go index a0db82fc..35c3b91d 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index f8298ff9..5edda768 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go index 5eb433bb..0dc9e8b4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index 703675c0..308ddf3a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 4e0d9610..418664e3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 01636b83..34d0b86d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index ad99bc10..b71cf45e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go index 89dcc427..e32df1c1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go index ee37aaa0..15ad6111 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 9862853d..fcf3ecbd 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux package unix @@ -448,4 +447,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 8901f0f4..f56dc250 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux package unix @@ -370,4 +369,6 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 6902c37e..974bf246 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux package unix @@ -412,4 +411,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index a6d3dff8..39a2739e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux package unix @@ -315,4 +314,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index b18f3f71..cf9c9d77 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux package unix @@ -309,4 +308,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 0302e5e3..10b7362e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux package unix @@ -432,4 +431,5 @@ const ( SYS_FUTEX_WAITV = 4449 SYS_SET_MEMPOLICY_HOME_NODE = 4450 SYS_CACHESTAT = 4451 + SYS_FCHMODAT2 = 4452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 6693ba4a..cd4d8b4f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux package unix @@ -362,4 +361,5 @@ const ( SYS_FUTEX_WAITV = 5449 SYS_SET_MEMPOLICY_HOME_NODE = 5450 SYS_CACHESTAT = 5451 + SYS_FCHMODAT2 = 5452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index fd93f498..2c0efca8 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux package unix @@ -362,4 +361,5 @@ const ( SYS_FUTEX_WAITV = 5449 SYS_SET_MEMPOLICY_HOME_NODE = 5450 SYS_CACHESTAT = 5451 + SYS_FCHMODAT2 = 5452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 760ddcad..a72e31d3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux package unix @@ -432,4 +431,5 @@ const ( SYS_FUTEX_WAITV = 4449 SYS_SET_MEMPOLICY_HOME_NODE = 4450 SYS_CACHESTAT = 4451 + SYS_FCHMODAT2 = 4452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index cff2b255..c7d1e374 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux package unix @@ -439,4 +438,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index a4b2405d..f4d4838c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux package unix @@ -411,4 +410,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index aca54b4e..b64f0e59 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux package unix @@ -411,4 +410,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 9d1738d6..95711195 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux package unix @@ -316,4 +315,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 022878dc..f94e943b 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux package unix @@ -377,4 +376,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 4100a761..ba0c2bc5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux package unix @@ -390,4 +389,5 @@ const ( SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go index 3a6699eb..b2aa8cd4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go index 5677cd4f..524a1b1c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go index e784cb6d..d59b943a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go index bd4952ef..31e771d5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index 59773381..9fd77c6c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index 16af2918..af10af28 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go index f59b18a9..cc2028af 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go index 721ef591..c06dd441 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go index 01c43a01..9ddbf3e0 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go index f258cfa2..19a6ee41 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go index 07919e0e..05192a78 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go index 073daad4..b2e30858 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go index 7a8161c1..3e6d57ca 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && aix -// +build ppc,aix package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go index 07ed733c..3a219bdc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && aix -// +build ppc64,aix package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 690cefc3..091d107f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 5bffc10e..28ff4ef7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index d0ba8e9b..30e405bb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 29dc4833..6cbd094a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index 0a89b289..7c03b6ee 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index c8666bb1..422107ee 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 88fb48a8..505a12ac 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go index 698dc975..cc986c79 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 18aa70b4..997bcd55 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -5883,3 +5882,15 @@ type SchedAttr struct { } const SizeofSchedAttr = 0x38 + +type Cachestat_t struct { + Cache uint64 + Dirty uint64 + Writeback uint64 + Evicted uint64 + Recently_evicted uint64 +} +type CachestatRange struct { + Off uint64 + Len uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 6d8acbcc..438a30af 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 59293c68..adceca35 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 40cfa38c..eeaa00a3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 055bc421..6739aa91 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index f28affbc..9920ef63 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 9d71e7cc..2923b799 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index fd5ccd33..ce2750ee 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 7704de77..3038811d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index df00b875..efc6fed1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 0942840d..9a654b75 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 03487439..40d358e3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index bad06704..148c6ceb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 1b4c97c3..72ba8154 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index aa268d02..71e76550 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 444045b6..4abbdb9d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index 9bc4c8f9..f22e7947 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index bb05f655..066a7d83 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index db40e3a1..439548ec 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go index 11121151..16085d3b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 26eba23b..afd13a3a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 5a547988..5d97f1f9 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index be58c4e1..34871cdc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go index 52338266..5911bceb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go index 605cfdb1..e4f24f3b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go index d6724c01..ca50a793 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go index ddfd27a4..d7d7f790 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index 0400747c..14160576 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && solaris -// +build amd64,solaris package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go index aec1efcb..54f31be6 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Hand edited based on ztypes_linux_s390x.go // TODO: auto-generate. diff --git a/vendor/modules.txt b/vendor/modules.txt index 18434769..73dd9634 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -19,10 +19,12 @@ github.com/gabriel-vasile/mimetype github.com/gabriel-vasile/mimetype/internal/charset github.com/gabriel-vasile/mimetype/internal/json github.com/gabriel-vasile/mimetype/internal/magic -# github.com/ggicci/httpin v0.10.1 -## explicit; go 1.16 +# github.com/ggicci/httpin v0.14.2 +## explicit; go 1.20 github.com/ggicci/httpin -github.com/ggicci/httpin/internal +# github.com/ggicci/owl v0.4.0 +## explicit; go 1.20 +github.com/ggicci/owl # github.com/go-playground/locales v0.14.1 ## explicit; go 1.17 github.com/go-playground/locales @@ -30,7 +32,7 @@ github.com/go-playground/locales/currency # github.com/go-playground/universal-translator v0.18.1 ## explicit; go 1.18 github.com/go-playground/universal-translator -# github.com/go-playground/validator/v10 v10.15.5 +# github.com/go-playground/validator/v10 v10.16.0 ## explicit; go 1.18 github.com/go-playground/validator/v10 # github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 @@ -69,8 +71,6 @@ github.com/rs/zerolog/log # github.com/sethvargo/go-envconfig v0.9.0 ## explicit; go 1.17 github.com/sethvargo/go-envconfig -# github.com/stretchr/testify v1.8.4 -## explicit; go 1.20 # golang.org/x/crypto v0.14.0 ## explicit; go 1.17 golang.org/x/crypto/sha3 @@ -85,12 +85,12 @@ golang.org/x/image/math/fixed ## explicit; go 1.17 golang.org/x/net/html golang.org/x/net/html/atom -# golang.org/x/sys v0.13.0 -## explicit; go 1.17 +# golang.org/x/sys v0.14.0 +## explicit; go 1.18 golang.org/x/sys/cpu golang.org/x/sys/unix -# golang.org/x/text v0.13.0 -## explicit; go 1.17 +# golang.org/x/text v0.14.0 +## explicit; go 1.18 golang.org/x/text/internal/language golang.org/x/text/internal/language/compact golang.org/x/text/internal/tag