diff --git a/.golangci.yml b/.golangci.yml index b30b7a12d..2cde7279f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,4 +13,5 @@ linters: - funlen - godox - gomnd - - gocognit \ No newline at end of file + - gocognit + - goerr113 diff --git a/go.mod b/go.mod index b9274791b..06fc28f91 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e github.com/client9/misspell v0.3.4 github.com/fatih/color v1.9.0 - github.com/golangci/golangci-lint v1.23.7 + github.com/golangci/golangci-lint v1.27.0 github.com/google/go-github/v28 v28.1.1 github.com/goreleaser/nfpm v1.2.1 github.com/imdario/mergo v0.3.9 diff --git a/go.sum b/go.sum index 3b659dc74..a080f46d8 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,8 @@ github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSW github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Djarvur/go-err113 v0.0.0-20200410182137-af658d038157 h1:hY39LwQHh+1kaovmIjOrlqnXNX6tygSRfLkkK33IkZU= +github.com/Djarvur/go-err113 v0.0.0-20200410182137-af658d038157/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20191009163259-e802c2cb94ae/go.mod h1:mjwGPas4yKduTyubHvD1Atl9r1rUq8DfVy+gkVvZ+oo= github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/semver/v3 v3.1.0 h1:Y2lUDsFKVRSYGojLJ1yLxSXdMmMYTYls0rCvoqmMUQk= @@ -59,8 +61,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb h1:m935MPodAbYS46DG4pJSv7WO+VECIWUQ7OJYSoTrMh4= github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI= -github.com/bombsimon/wsl/v2 v2.0.0 h1:+Vjcn+/T5lSrO8Bjzhk4v14Un/2UyCA1E3V5j9nwTkQ= -github.com/bombsimon/wsl/v2 v2.0.0/go.mod h1:mf25kr/SqFEPhhcxW1+7pxzGlW+hIl/hYTKY95VwV8U= +github.com/bombsimon/wsl/v3 v3.0.0 h1:w9f49xQatuaeTJFaNP4SpiWSR5vfT6IstPtM62JjcqA= +github.com/bombsimon/wsl/v3 v3.0.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/caarlos0/ctrlc v1.0.0 h1:2DtF8GSIcajgffDFJzyG15vO+1PuBWOMUdFut7NnXhw= github.com/caarlos0/ctrlc v1.0.0/go.mod h1:CdXpj4rmq0q/1Eb44M9zi2nKB0QraNKuRGYGrrHhcQw= github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e h1:V9a67dfYqPLAvzk5hMQOXYJlZ4SLIXgyKIE+ZiHzgGQ= @@ -80,7 +82,7 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -131,6 +133,7 @@ github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUD github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= github.com/go-toolsmith/typep v1.0.0 h1:zKymWyA1TRYvqYrYDrfEMZULyrhcnGY3x7LDKU2XQaA= github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= +github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b h1:ekuhfTjngPhisSjOJ0QWKpPQE8/rbknHaes6WVJj5Hw= @@ -164,8 +167,8 @@ github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee h1:J2XAy40+7yz70u github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.23.7 h1:/rWK6IXb9k554NPStxDapUgHsJhKf73AsSWvYqIDkp8= -github.com/golangci/golangci-lint v1.23.7/go.mod h1:g/38bxfhp4rI7zeWSxcdIeHTQGS58TCak8FYcyCmavQ= +github.com/golangci/golangci-lint v1.27.0 h1:VYLx63qb+XJsHdZ27PMS2w5JZacN0XG8ffUwe7yQomo= +github.com/golangci/golangci-lint v1.27.0/go.mod h1:+eZALfxIuthdrHPtfM7w/R3POJLjHDfJJw8XZl9xOng= github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc h1:gLLhTLMk2/SutryVJ6D4VZCU3CUqr8YloG7FPIBWFpI= github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= @@ -213,6 +216,7 @@ github.com/googleapis/gax-go v2.0.2+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= 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/goreleaser/nfpm v1.2.1 h1:AEnu9XVmupRDTR930Z2rAs31Mj6sLIPxFcR9ESYvgDA= @@ -275,16 +279,18 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKoALdbQ= +github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= @@ -310,22 +316,28 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= +github.com/mozilla/tls-observatory v0.0.0-20200317151703-4fa42e1c2dee/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nakabonne/nestif v0.3.0 h1:+yOViDGhg8ygGrmII72nV9B/zGxY188TYpfolntsaPw= +github.com/nakabonne/nestif v0.3.0/go.mod h1:dI314BppzXjJ4HsCnbo7XzrJHPszZsjnk5wEBSYHI2c= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= -github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.8.1 h1:C5Dqfs/LeauYDX0jJXIe2SWmwCbGzx9yF8C8xy3Lh34= -github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= +github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -347,10 +359,12 @@ github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryancurrah/gomodguard v1.0.4 h1:oCreMAt9GuFXDe9jW4HBpc3GjdX3R/sUEcLAGh1zPx8= +github.com/ryancurrah/gomodguard v1.0.4/go.mod h1:9T/Cfuxs5StfsocWr4WzDL36HqnX0fVb9d5fSEaLhoE= github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b h1:+gCnWOZV8Z/8jehJ2CdqB47Z3S+SREmQcuXkRFLNsiI= github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b/go.mod h1:am+Fp8Bt506lA3Rk3QCmSqmYmLMnPDhdDUcosQCAx+I= -github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83 h1:AtnWoOvTioyDXFvu96MWEeE8qj4COSQnJogzLy/u41A= -github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83/go.mod h1:vvbZ2Ae7AzSq3/kywjUDxSNq2SJ27RxCz2un0H3ePqE= +github.com/securego/gosec/v2 v2.3.0 h1:y/9mCF2WPDbSDpL3QDWZD3HHGrSYw0QSHnCqTfs4JPE= +github.com/securego/gosec/v2 v2.3.0/go.mod h1:UzeVyUXbxukhLeHKV3VVqo7HdoQR9MrRfFmZYotn8ME= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= @@ -400,6 +414,10 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0KQWXKNqmwe8vEeSUiUj4Rlee9CMVX2ZUQ= +github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= +github.com/tetafro/godot v0.3.7 h1:+mecr7RKrUKB5UQ1gwqEMn13sDKTyDR8KNIquB9mm+8= +github.com/tetafro/godot v0.3.7/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/tj/assert v0.0.0-20171129193455-018094318fb0 h1:Rw8kxzWo1mr6FSaYXjQELRe88y2KdfynXdnK72rdjtA= @@ -408,8 +426,8 @@ github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eN github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao= github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tommy-muehle/go-mnd v1.1.1 h1:4D0wuPKjOTiK2garzuPGGvm4zZ/wLYDOH8TJSABC7KU= -github.com/tommy-muehle/go-mnd v1.1.1/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= +github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa h1:RC4maTWLKKwb7p1cnoygsbKIgNlJqSYBeAFON3Ar8As= +github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= @@ -431,6 +449,8 @@ github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofm github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -461,8 +481,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -481,8 +501,8 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -513,9 +533,10 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190620070143-6f217b454f45/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e h1:N7DeIrjYszNmSW409R3frPPwglRwMkXSBzwVbkOjLLA= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= @@ -543,18 +564,23 @@ golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113232020-e2727e816f5a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200102140908-9497f49d5709/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204192400-7124308813f3 h1:Ms82wn6YK4ZycO6Bxyh0kxX3gFFVGo79CCuc52xgcys= -golang.org/x/tools v0.0.0-20200204192400-7124308813f3/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200331202046-9d5940d49312/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770 h1:M9Fif0OxNji8w+HvmhVQ8KJtiZOsjU9RgslJGhn95XE= +golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.6.0/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4= @@ -589,6 +615,8 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -601,16 +629,14 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= diff --git a/internal/artifact/artifact.go b/internal/artifact/artifact.go index c20af7dcf..861b80dfc 100644 --- a/internal/artifact/artifact.go +++ b/internal/artifact/artifact.go @@ -1,4 +1,4 @@ -// Package artifact provides the core artifact storage for goreleaser +// Package artifact provides the core artifact storage for goreleaser. package artifact // nolint: gosec @@ -19,7 +19,7 @@ import ( "github.com/pkg/errors" ) -// Type defines the type of an artifact +// Type defines the type of an artifact. type Type int const ( @@ -76,7 +76,7 @@ func (t Type) String() string { return "unknown" } -// Artifact represents an artifact and its relevant info +// Artifact represents an artifact and its relevant info. type Artifact struct { Name string Path string @@ -105,7 +105,7 @@ func (a Artifact) Checksum(algorithm string) (string, error) { if err != nil { return "", errors.Wrap(err, "failed to checksum") } - defer file.Close() // nolint: errcheck + defer file.Close() var h hash.Hash switch algorithm { case "crc32": @@ -132,13 +132,13 @@ func (a Artifact) Checksum(algorithm string) (string, error) { return hex.EncodeToString(h.Sum(nil)), nil } -// Artifacts is a list of artifacts +// Artifacts is a list of artifacts. type Artifacts struct { items []*Artifact lock *sync.Mutex } -// New return a new list of artifacts +// New return a new list of artifacts. func New() Artifacts { return Artifacts{ items: []*Artifact{}, @@ -146,12 +146,12 @@ func New() Artifacts { } } -// List return the actual list of artifacts +// List return the actual list of artifacts. func (artifacts Artifacts) List() []*Artifact { return artifacts.items } -// GroupByPlatform groups the artifacts by their platform +// GroupByPlatform groups the artifacts by their platform. func (artifacts Artifacts) GroupByPlatform() map[string][]*Artifact { var result = map[string][]*Artifact{} for _, a := range artifacts.items { @@ -161,7 +161,7 @@ func (artifacts Artifacts) GroupByPlatform() map[string][]*Artifact { return result } -// Add safely adds a new artifact to an artifact list +// Add safely adds a new artifact to an artifact list. func (artifacts *Artifacts) Add(a *Artifact) { artifacts.lock.Lock() defer artifacts.lock.Unlock() @@ -174,31 +174,31 @@ func (artifacts *Artifacts) Add(a *Artifact) { } // Filter defines an artifact filter which can be used within the Filter -// function +// function. type Filter func(a *Artifact) bool -// ByGoos is a predefined filter that filters by the given goos +// ByGoos is a predefined filter that filters by the given goos. func ByGoos(s string) Filter { return func(a *Artifact) bool { return a.Goos == s } } -// ByGoarch is a predefined filter that filters by the given goarch +// ByGoarch is a predefined filter that filters by the given goarch. func ByGoarch(s string) Filter { return func(a *Artifact) bool { return a.Goarch == s } } -// ByGoarm is a predefined filter that filters by the given goarm +// ByGoarm is a predefined filter that filters by the given goarm. func ByGoarm(s string) Filter { return func(a *Artifact) bool { return a.Goarm == s } } -// ByType is a predefined filter that filters by the given type +// ByType is a predefined filter that filters by the given type. func ByType(t Type) Filter { return func(a *Artifact) bool { return a.Type == t @@ -232,7 +232,7 @@ func ByIDs(ids ...string) Filter { return Or(filters...) } -// Or performs an OR between all given filters +// Or performs an OR between all given filters. func Or(filters ...Filter) Filter { return func(a *Artifact) bool { for _, f := range filters { @@ -244,7 +244,7 @@ func Or(filters ...Filter) Filter { } } -// And performs an AND between all given filters +// And performs an AND between all given filters. func And(filters ...Filter) Filter { return func(a *Artifact) bool { for _, f := range filters { diff --git a/internal/builders/golang/build.go b/internal/builders/golang/build.go index 8cf8e05c1..41537820d 100644 --- a/internal/builders/golang/build.go +++ b/internal/builders/golang/build.go @@ -19,7 +19,7 @@ import ( "github.com/pkg/errors" ) -// Default builder instance +// Default builder instance. // nolint: gochecknoglobals var Default = &Builder{} @@ -28,10 +28,10 @@ func init() { api.Register("go", Default) } -// Builder is golang builder +// Builder is golang builder. type Builder struct{} -// WithDefaults sets the defaults for a golang build and returns it +// WithDefaults sets the defaults for a golang build and returns it. func (*Builder) WithDefaults(build config.Build) config.Build { if build.Dir == "" { build.Dir = "." @@ -57,7 +57,7 @@ func (*Builder) WithDefaults(build config.Build) config.Build { return build } -// Build builds a golang build +// Build builds a golang build. func (*Builder) Build(ctx *context.Context, build config.Build, options api.Options) error { if err := checkMain(build); err != nil { return err diff --git a/internal/client/client.go b/internal/client/client.go index 57c0ae43a..34c20b633 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -10,21 +10,21 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Info of the repository +// Info of the repository. type Info struct { Description string Homepage string URL string } -// Client interface +// Client interface. type Client interface { CreateRelease(ctx *context.Context, body string) (releaseID string, err error) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content []byte, path, message string) (err error) Upload(ctx *context.Context, releaseID string, artifact *artifact.Artifact, file *os.File) (err error) } -// New creates a new client depending on the token type +// New creates a new client depending on the token type. func New(ctx *context.Context) (Client, error) { log.WithField("type", ctx.TokenType).Info("token type") if ctx.TokenType == context.TokenTypeGitHub { diff --git a/internal/client/gitea.go b/internal/client/gitea.go index a08ce8566..cd6909e97 100644 --- a/internal/client/gitea.go +++ b/internal/client/gitea.go @@ -33,7 +33,7 @@ func getInstanceURL(apiURL string) (string, error) { return rawurl, nil } -// NewGitea returns a gitea client implementation +// NewGitea returns a gitea client implementation. func NewGitea(ctx *context.Context) (Client, error) { instanceURL, err := getInstanceURL(ctx.Config.GiteaURLs.API) if err != nil { @@ -52,7 +52,7 @@ func NewGitea(ctx *context.Context) (Client, error) { } // CreateFile creates a file in the repository at a given path -// or updates the file if it exists +// or updates the file if it exists. func (c *giteaClient) CreateFile( ctx *context.Context, commitAuthor config.CommitAuthor, @@ -132,7 +132,7 @@ func (c *giteaClient) updateRelease(ctx *context.Context, title, body string, id } // CreateRelease creates a new release or updates it by keeping -// the release notes if it exists +// the release notes if it exists. func (c *giteaClient) CreateRelease(ctx *context.Context, body string) (string, error) { var release *gitea.Release var err error @@ -168,7 +168,7 @@ func (c *giteaClient) CreateRelease(ctx *context.Context, body string) (string, return strconv.FormatInt(release.ID, 10), nil } -// Upload uploads a file into a release repository +// Upload uploads a file into a release repository. func (c *giteaClient) Upload( ctx *context.Context, releaseID string, diff --git a/internal/client/github.go b/internal/client/github.go index 5b8dce119..ff17c7c94 100644 --- a/internal/client/github.go +++ b/internal/client/github.go @@ -21,14 +21,13 @@ type githubClient struct { client *github.Client } -// NewGitHub returns a github client implementation +// NewGitHub returns a github client implementation. func NewGitHub(ctx *context.Context) (Client, error) { ts := oauth2.StaticTokenSource( &oauth2.Token{AccessToken: ctx.Token}, ) httpClient := oauth2.NewClient(ctx, ts) base := httpClient.Transport.(*oauth2.Transport).Base - // nolint: govet if base == nil || reflect.ValueOf(base).IsNil() { base = http.DefaultTransport } diff --git a/internal/client/gitlab.go b/internal/client/gitlab.go index f712b378c..cbafcf252 100644 --- a/internal/client/gitlab.go +++ b/internal/client/gitlab.go @@ -15,14 +15,14 @@ import ( "github.com/xanzy/go-gitlab" ) -// ErrExtractHashFromFileUploadURL indicates the file upload hash could not ne extracted from the url +// ErrExtractHashFromFileUploadURL indicates the file upload hash could not ne extracted from the url. var ErrExtractHashFromFileUploadURL = errors.New("could not extract hash from gitlab file upload url") type gitlabClient struct { client *gitlab.Client } -// NewGitLab returns a gitlab client implementation +// NewGitLab returns a gitlab client implementation. func NewGitLab(ctx *context.Context) (Client, error) { token := ctx.Token transport := &http.Transport{ @@ -47,7 +47,7 @@ func NewGitLab(ctx *context.Context) (Client, error) { } // CreateFile gets a file in the repository at a given path -// and updates if it exists or creates it for later pipes in the pipeline +// and updates if it exists or creates it for later pipes in the pipeline. func (c *gitlabClient) CreateFile( ctx *context.Context, commitAuthor config.CommitAuthor, @@ -157,7 +157,7 @@ func (c *gitlabClient) CreateFile( } // CreateRelease creates a new release or updates it by keeping -// the release notes if it exists +// the release notes if it exists. func (c *gitlabClient) CreateRelease(ctx *context.Context, body string) (releaseID string, err error) { title, err := tmpl.New(ctx).Apply(ctx.Config.Release.NameTemplate) if err != nil { @@ -229,7 +229,7 @@ func (c *gitlabClient) CreateRelease(ctx *context.Context, body string) (release return tagName, err // gitlab references a tag in a repo by its name } -// Upload uploads a file into a release repository +// Upload uploads a file into a release repository. func (c *gitlabClient) Upload( ctx *context.Context, releaseID string, @@ -292,7 +292,7 @@ func (c *gitlabClient) Upload( } // extractProjectFileHashFrom extracts the hash from the -// relative project file url of the format '/uploads//filename.ext' +// relative project file url of the format '/uploads//filename.ext'. func extractProjectFileHashFrom(projectFileURL string) (string, error) { log.WithField("projectFileURL", projectFileURL).Debug("extract file hash from") splittedProjectFileURL := strings.Split(projectFileURL, "/") diff --git a/internal/deprecate/deprecate.go b/internal/deprecate/deprecate.go index 1bf196ad5..776e8759b 100644 --- a/internal/deprecate/deprecate.go +++ b/internal/deprecate/deprecate.go @@ -13,7 +13,7 @@ import ( const baseURL = "https://goreleaser.com/deprecations#" -// Notice warns the user about the deprecation of the given property +// Notice warns the user about the deprecation of the given property. func Notice(ctx *context.Context, property string) { ctx.Deprecated = true cli.Default.Padding += 3 diff --git a/internal/exec/exec.go b/internal/exec/exec.go index 5a8f37847..2deb9ab36 100644 --- a/internal/exec/exec.go +++ b/internal/exec/exec.go @@ -111,7 +111,7 @@ type command struct { } // resolveCommand returns the a command based on publisher template with replaced variables -// Those variables can be replaced by the given context, goos, goarch, goarm and more +// Those variables can be replaced by the given context, goos, goarch, goarm and more. func resolveCommand(ctx *context.Context, publisher config.Publisher, artifact *artifact.Artifact) (*command, error) { var err error diff --git a/internal/git/git.go b/internal/git/git.go index c61c549dc..00ab01807 100644 --- a/internal/git/git.go +++ b/internal/git/git.go @@ -9,13 +9,13 @@ import ( "github.com/apex/log" ) -// IsRepo returns true if current folder is a git repository +// IsRepo returns true if current folder is a git repository. func IsRepo() bool { out, err := Run("rev-parse", "--is-inside-work-tree") return err == nil && strings.TrimSpace(out) == "true" } -// Run runs a git command and returns its output or errors +// Run runs a git command and returns its output or errors. func Run(args ...string) (string, error) { // TODO: use exex.CommandContext here and refactor. var extraArgs = []string{ @@ -34,7 +34,7 @@ func Run(args ...string) (string, error) { return string(bts), nil } -// Clean the output +// Clean the output. func Clean(output string, err error) (string, error) { output = strings.Replace(strings.Split(output, "\n")[0], "'", "", -1) if err != nil { diff --git a/internal/http/http.go b/internal/http/http.go index 506dc133a..d82fc51be 100644 --- a/internal/http/http.go +++ b/internal/http/http.go @@ -67,7 +67,7 @@ func assetOpenDefault(kind string, a *artifact.Artifact) (*asset, error) { }, nil } -// Defaults sets default configuration options on upload structs +// Defaults sets default configuration options on upload structs. func Defaults(uploads []config.Upload) error { for i := range uploads { defaults(&uploads[i]) @@ -84,7 +84,7 @@ func defaults(upload *config.Upload) { } } -// CheckConfig validates an upload configuration returning a descriptive error when appropriate +// CheckConfig validates an upload configuration returning a descriptive error when appropriate. func CheckConfig(ctx *context.Context, upload *config.Upload, kind string) error { if upload.Target == "" { return misconfigured(kind, upload, "missing target") @@ -142,7 +142,7 @@ func misconfigured(kind string, upload *config.Upload, reason string) error { // It must return and error when the response must be considered a failure. type ResponseChecker func(*h.Response) error -// Upload does the actual uploading work +// Upload does the actual uploading work. func Upload(ctx *context.Context, uploads []config.Upload, kind string, check ResponseChecker) error { if ctx.SkipPublish { return pipe.ErrSkipPublishEnabled @@ -204,7 +204,7 @@ func uploadWithFilter(ctx *context.Context, upload *config.Upload, filter artifa return g.Wait() } -// uploadAsset uploads file to target and logs all actions +// uploadAsset uploads file to target and logs all actions. func uploadAsset(ctx *context.Context, upload *config.Upload, artifact *artifact.Artifact, kind string, check ResponseChecker) error { username, err := getUsername(ctx, upload, kind) if err != nil { @@ -229,7 +229,7 @@ func uploadAsset(ctx *context.Context, upload *config.Upload, artifact *artifact if err != nil { return err } - defer asset.ReadCloser.Close() // nolint: errcheck + defer asset.ReadCloser.Close() // target url need to contain the artifact name unless the custom // artifact name is used @@ -271,7 +271,7 @@ func uploadAsset(ctx *context.Context, upload *config.Upload, artifact *artifact return nil } -// uploadAssetToServer uploads the asset file to target +// uploadAssetToServer uploads the asset file to target. func uploadAssetToServer(ctx *context.Context, upload *config.Upload, target, username, secret string, headers map[string]string, a *asset, check ResponseChecker) (*h.Response, error) { req, err := newUploadRequest(upload.Method, target, username, secret, headers, a) if err != nil { @@ -281,7 +281,7 @@ func uploadAssetToServer(ctx *context.Context, upload *config.Upload, target, us return executeHTTPRequest(ctx, upload, req, check) } -// newUploadRequest creates a new h.Request for uploading +// newUploadRequest creates a new h.Request for uploading. func newUploadRequest(method, target, username, secret string, headers map[string]string, a *asset) (*h.Request, error) { req, err := h.NewRequest(method, target, a.ReadCloser) if err != nil { @@ -320,7 +320,7 @@ func getHTTPClient(upload *config.Upload) (*h.Client, error) { }, nil } -// executeHTTPRequest processes the http call with respect of context ctx +// executeHTTPRequest processes the http call with respect of context ctx. func executeHTTPRequest(ctx *context.Context, upload *config.Upload, req *h.Request, check ResponseChecker) (*h.Response, error) { client, err := getHTTPClient(upload) if err != nil { @@ -339,7 +339,7 @@ func executeHTTPRequest(ctx *context.Context, upload *config.Upload, req *h.Requ return nil, err } - defer resp.Body.Close() // nolint: errcheck + defer resp.Body.Close() err = check(resp) if err != nil { @@ -352,7 +352,7 @@ func executeHTTPRequest(ctx *context.Context, upload *config.Upload, req *h.Requ } // resolveTargetTemplate returns the resolved target template with replaced variables -// Those variables can be replaced by the given context, goos, goarch, goarm and more +// Those variables can be replaced by the given context, goos, goarch, goarm and more. func resolveTargetTemplate(ctx *context.Context, upload *config.Upload, artifact *artifact.Artifact) (string, error) { var replacements = map[string]string{} if upload.Mode == ModeBinary { diff --git a/internal/ids/ids.go b/internal/ids/ids.go index 74df3ea7e..d8f89ba94 100644 --- a/internal/ids/ids.go +++ b/internal/ids/ids.go @@ -3,13 +3,13 @@ package ids import "fmt" -// IDs is the IDs type +// IDs is the IDs type. type IDs struct { ids map[string]int kind string } -// New IDs +// New IDs. func New(kind string) IDs { return IDs{ ids: map[string]int{}, @@ -17,12 +17,12 @@ func New(kind string) IDs { } } -// Inc increment the counter of the given id +// Inc increment the counter of the given id. func (i IDs) Inc(id string) { i.ids[id]++ } -// Validate errors if there are any ids with counter > 1 +// Validate errors if there are any ids with counter > 1. func (i IDs) Validate() error { for id, count := range i.ids { if count > 1 { diff --git a/internal/linux/arch.go b/internal/linux/arch.go index 748c112ab..54302233b 100644 --- a/internal/linux/arch.go +++ b/internal/linux/arch.go @@ -3,10 +3,9 @@ package linux import "strings" -// Arch converts a goarch to a linux-compatible arch -// -// list of all linux arches: `go tool dist list | grep linux` +// Arch converts a goarch to a linux-compatible arch. func Arch(key string) string { + // XXX: list of all linux arches: `go tool dist list | grep linux` var arch = strings.TrimPrefix(key, "linux") switch arch { case "386": diff --git a/internal/logext/writer.go b/internal/logext/writer.go index 1614027be..55a9bd56b 100644 --- a/internal/logext/writer.go +++ b/internal/logext/writer.go @@ -2,12 +2,12 @@ package logext import "github.com/apex/log" -// Writer writes with log.Info +// Writer writes with log.Info. type Writer struct { ctx *log.Entry } -// NewWriter creates a new log writer +// NewWriter creates a new log writer. func NewWriter(ctx *log.Entry) Writer { return Writer{ctx: ctx} } @@ -17,12 +17,12 @@ func (t Writer) Write(p []byte) (n int, err error) { return len(p), nil } -// Writer writes with log.Error +// Writer writes with log.Error. type ErrorWriter struct { ctx *log.Entry } -// NewWriter creates a new log writer +// NewWriter creates a new log writer. func NewErrWriter(ctx *log.Entry) ErrorWriter { return ErrorWriter{ctx: ctx} } diff --git a/internal/pipe/archive/archive.go b/internal/pipe/archive/archive.go index 71e202738..83a27cb81 100644 --- a/internal/pipe/archive/archive.go +++ b/internal/pipe/archive/archive.go @@ -20,7 +20,6 @@ import ( "github.com/goreleaser/goreleaser/internal/semerrgroup" "github.com/goreleaser/goreleaser/internal/tmpl" "github.com/goreleaser/goreleaser/pkg/archive" - archivelib "github.com/goreleaser/goreleaser/pkg/archive" "github.com/goreleaser/goreleaser/pkg/config" "github.com/goreleaser/goreleaser/pkg/context" ) @@ -33,14 +32,14 @@ const ( // nolint: gochecknoglobals var lock sync.Mutex -// Pipe for archive +// Pipe for archive. type Pipe struct{} func (Pipe) String() string { return "archives" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { var ids = ids.New("archives") if len(ctx.Config.Archives) == 0 { @@ -82,7 +81,7 @@ func (Pipe) Default(ctx *context.Context) error { return ids.Validate() } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { var g = semerrgroup.New(ctx.Parallelism) for _, archive := range ctx.Config.Archives { @@ -107,11 +106,11 @@ func (Pipe) Run(ctx *context.Context) error { return g.Wait() } -func create(ctx *context.Context, archive config.Archive, binaries []*artifact.Artifact) error { - var format = packageFormat(archive, binaries[0].Goos) +func create(ctx *context.Context, arch config.Archive, binaries []*artifact.Artifact) error { + var format = packageFormat(arch, binaries[0].Goos) folder, err := tmpl.New(ctx). - WithArtifact(binaries[0], archive.Replacements). - Apply(archive.NameTemplate) + WithArtifact(binaries[0], arch.Replacements). + Apply(arch.NameTemplate) if err != nil { return err } @@ -131,23 +130,22 @@ func create(ctx *context.Context, archive config.Archive, binaries []*artifact.A return fmt.Errorf("failed to create directory %s: %s", archivePath, err.Error()) } lock.Unlock() - defer archiveFile.Close() // nolint: errcheck + defer archiveFile.Close() var log = log.WithField("archive", archivePath) log.Info("creating") template := tmpl.New(ctx). - WithArtifact(binaries[0], archive.Replacements) - wrap, err := template. - Apply(wrapFolder(archive)) + WithArtifact(binaries[0], arch.Replacements) + wrap, err := template.Apply(wrapFolder(arch)) if err != nil { return err } - var a = NewEnhancedArchive(archivelib.New(archiveFile), wrap) - defer a.Close() // nolint: errcheck + var a = NewEnhancedArchive(archive.New(archiveFile), wrap) + defer a.Close() - files, err := findFiles(template, archive) + files, err := findFiles(template, arch) if err != nil { return fmt.Errorf("failed to find files to archive: %s", err.Error()) } @@ -171,8 +169,8 @@ func create(ctx *context.Context, archive config.Archive, binaries []*artifact.A Gomips: binaries[0].Gomips, Extra: map[string]interface{}{ "Builds": binaries, - "ID": archive.ID, - "Format": archive.Format, + "ID": arch.ID, + "Format": arch.Format, "WrappedIn": wrap, }, }) @@ -264,7 +262,7 @@ type EnhancedArchive struct { files map[string]string } -// Add adds a file +// Add adds a file. func (d EnhancedArchive) Add(name, path string) error { name = strings.Replace(filepath.Join(d.wrap, name), "\\", "/", -1) log.Debugf("adding file: %s as %s", path, name) @@ -275,7 +273,7 @@ func (d EnhancedArchive) Add(name, path string) error { return d.a.Add(name, path) } -// Close closes the underlying archive +// Close closes the underlying archive. func (d EnhancedArchive) Close() error { return d.a.Close() } diff --git a/internal/pipe/artifactory/artifactory.go b/internal/pipe/artifactory/artifactory.go index 6fae415c8..5f1e97303 100644 --- a/internal/pipe/artifactory/artifactory.go +++ b/internal/pipe/artifactory/artifactory.go @@ -27,23 +27,22 @@ type artifactoryResponse struct { URI string `json:"uri,omitempty"` } -// artifactoryChecksums reflects the checksums generated by -// Artifactory +// artifactoryChecksums reflects the checksums generated by Artifactory. type artifactoryChecksums struct { SHA1 string `json:"sha1,omitempty"` MD5 string `json:"md5,omitempty"` SHA256 string `json:"sha256,omitempty"` } -// Pipe for Artifactory +// Pipe for Artifactory. type Pipe struct{} -// String returns the description of the pipe +// String returns the description of the pipe. func (Pipe) String() string { return "artifactory" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { for i := range ctx.Config.Artifactories { ctx.Config.Artifactories[i].ChecksumHeader = "X-Checksum-SHA256" @@ -52,7 +51,7 @@ func (Pipe) Default(ctx *context.Context) error { return http.Defaults(ctx.Config.Artifactories) } -// Publish artifacts to artifactory +// Publish artifacts to artifactory. // // Docs: https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-Example-DeployinganArtifact func (Pipe) Publish(ctx *context.Context) error { diff --git a/internal/pipe/before/before.go b/internal/pipe/before/before.go index a6826733e..eb756cdd8 100644 --- a/internal/pipe/before/before.go +++ b/internal/pipe/before/before.go @@ -1,3 +1,4 @@ +// Package before provides the pipe implementation that runs before all other pipes. package before import ( @@ -11,15 +12,15 @@ import ( "github.com/mattn/go-shellwords" ) -// Pipe is a global hook pipe +// Pipe is a global hook pipe. type Pipe struct{} -// String is the name of this pipe +// String is the name of this pipe. func (Pipe) String() string { return "running before hooks" } -// Run executes the hooks +// Run executes the hooks. func (Pipe) Run(ctx *context.Context) error { var tmpl = tmpl.New(ctx) /* #nosec */ diff --git a/internal/pipe/blob/blob.go b/internal/pipe/blob/blob.go index d755075e6..4276f6517 100644 --- a/internal/pipe/blob/blob.go +++ b/internal/pipe/blob/blob.go @@ -1,3 +1,4 @@ +// Package blob provides the pipe implementation that uploads files to "blob" providers, such as s3, gcs and azure. package blob import ( @@ -9,15 +10,15 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Pipe for Artifactory +// Pipe for blobs. type Pipe struct{} -// String returns the description of the pipe +// String returns the description of the pipe. func (Pipe) String() string { return "blobs" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { for i := range ctx.Config.Blobs { blob := &ctx.Config.Blobs[i] @@ -32,7 +33,7 @@ func (Pipe) Default(ctx *context.Context) error { return nil } -// Publish to specified blob bucket url +// Publish to specified blob bucket url. func (Pipe) Publish(ctx *context.Context) error { if len(ctx.Config.Blobs) == 0 { return pipe.Skip("blobs section is not configured") @@ -48,7 +49,7 @@ func (Pipe) Publish(ctx *context.Context) error { return g.Wait() } -// errorContains check if error contains specific string +// errorContains check if error contains specific string. func errorContains(err error, subs ...string) bool { for _, sub := range subs { if strings.Contains(err.Error(), sub) { diff --git a/internal/pipe/blob/upload.go b/internal/pipe/blob/upload.go index 3e7ba9ee2..8b780e2dc 100644 --- a/internal/pipe/blob/upload.go +++ b/internal/pipe/blob/upload.go @@ -62,7 +62,7 @@ func urlFor(ctx *context.Context, conf config.Blob) (string, error) { // Takes goreleaser context(which includes artificats) and bucketURL for // upload to destination (eg: gs://gorelease-bucket) using the given uploader -// implementation +// implementation. func doUpload(ctx *context.Context, conf config.Blob) error { folder, err := tmpl.New(ctx).Apply(conf.Folder) if err != nil { @@ -186,7 +186,7 @@ func getData(ctx *context.Context, conf config.Blob, path string) ([]byte, error return data, err } -// uploader implements upload +// uploader implements upload. type uploader interface { io.Closer Open(ctx *context.Context, url string) error @@ -194,7 +194,7 @@ type uploader interface { } // skipUploader is used when --skip-upload is set and will just log -// things without really doing anything +// things without really doing anything. type skipUploader struct{} func (u *skipUploader) Close() error { return nil } @@ -205,7 +205,7 @@ func (u *skipUploader) Upload(_ *context.Context, path string, _ []byte) error { return nil } -// productionUploader actually do upload to +// productionUploader actually do upload to. type productionUploader struct { bucket *blob.Bucket } diff --git a/internal/pipe/brew/brew.go b/internal/pipe/brew/brew.go index 7baebdd05..d0046b342 100644 --- a/internal/pipe/brew/brew.go +++ b/internal/pipe/brew/brew.go @@ -19,17 +19,17 @@ import ( "github.com/pkg/errors" ) -// ErrNoArchivesFound happens when 0 archives are found +// ErrNoArchivesFound happens when 0 archives are found. var ErrNoArchivesFound = errors.New("no linux/macos archives found") // ErrMultipleArchivesSameOS happens when the config yields multiple archives // for linux or windows. var ErrMultipleArchivesSameOS = errors.New("one tap can handle only archive of an OS/Arch combination. Consider using ids in the brew section") -// ErrEmptyTokenType indicates unknown token type +// ErrEmptyTokenType indicates unknown token type. var ErrEmptyTokenType = errors.New("no token type found") -// ErrTokenTypeNotImplementedForBrew indicates that a new token type was not implemented for this pipe +// ErrTokenTypeNotImplementedForBrew indicates that a new token type was not implemented for this pipe. type ErrTokenTypeNotImplementedForBrew struct { TokenType context.TokenType } @@ -41,14 +41,14 @@ func (e ErrTokenTypeNotImplementedForBrew) Error() string { return "token type not implemented for brew pipe" } -// Pipe for brew deployment +// Pipe for brew deployment. type Pipe struct{} func (Pipe) String() string { return "homebrew tap formula" } -// Publish brew formula +// Publish brew formula. func (Pipe) Publish(ctx *context.Context) error { client, err := client.New(ctx) if err != nil { @@ -62,7 +62,7 @@ func (Pipe) Publish(ctx *context.Context) error { return nil } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { for i := range ctx.Config.Brews { var brew = &ctx.Config.Brews[i] @@ -156,7 +156,7 @@ func doRun(ctx *context.Context, brew config.Homebrew, client client.Client) err var filename = brew.Name + ".rb" var path = filepath.Join(ctx.Config.Dist, filename) log.WithField("formula", path).Info("writing") - if err := ioutil.WriteFile(path, []byte(content), 0644); err != nil { + if err := ioutil.WriteFile(path, []byte(content), 0644); err != nil { //nolint: gosec return errors.Wrap(err, "failed to write brew tap") } @@ -268,7 +268,8 @@ func dataFor(ctx *context.Context, cfg config.Homebrew, tokenType context.TokenT DownloadURL: url, SHA256: sum, } - if artifact.Goos == "darwin" { + // TODO: refactor + if artifact.Goos == "darwin" { // nolint: nestif if result.MacOS.DownloadURL != "" { return result, ErrMultipleArchivesSameOS } diff --git a/internal/pipe/build/build.go b/internal/pipe/build/build.go index 7c3816f29..c5b2ec474 100644 --- a/internal/pipe/build/build.go +++ b/internal/pipe/build/build.go @@ -23,14 +23,14 @@ import ( _ "github.com/goreleaser/goreleaser/internal/builders/golang" ) -// Pipe for build +// Pipe for build. type Pipe struct{} func (Pipe) String() string { return "building binaries" } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { for _, build := range ctx.Config.Builds { if build.Skip { @@ -45,7 +45,7 @@ func (Pipe) Run(ctx *context.Context) error { return nil } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { var ids = ids.New("builds") for i, build := range ctx.Config.Builds { diff --git a/internal/pipe/changelog/changelog.go b/internal/pipe/changelog/changelog.go index ede936957..e518f8563 100644 --- a/internal/pipe/changelog/changelog.go +++ b/internal/pipe/changelog/changelog.go @@ -17,17 +17,17 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// ErrInvalidSortDirection happens when the sort order is invalid +// ErrInvalidSortDirection happens when the sort order is invalid. var ErrInvalidSortDirection = errors.New("invalid sort direction") -// Pipe for checksums +// Pipe for checksums. type Pipe struct{} func (Pipe) String() string { return "generating changelog" } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { // TODO: should probably have a different field for the filename and its // contents. @@ -93,7 +93,7 @@ func (Pipe) Run(ctx *context.Context) error { var path = filepath.Join(ctx.Config.Dist, "CHANGELOG.md") log.WithField("changelog", path).Info("writing") - return ioutil.WriteFile(path, []byte(ctx.ReleaseNotes), 0644) + return ioutil.WriteFile(path, []byte(ctx.ReleaseNotes), 0644) //nolint: gosec } func loadFromFile(file string) (string, error) { @@ -204,7 +204,7 @@ func previous(tag string) (result string, err error) { // nolint: gochecknoglobals var validSHA1 = regexp.MustCompile(`^[a-fA-F0-9]{40}$`) -// isSHA1 te lets us know if the ref is a SHA1 or not +// isSHA1 te lets us know if the ref is a SHA1 or not. func isSHA1(ref string) bool { return validSHA1.MatchString(ref) } diff --git a/internal/pipe/checksums/checksums.go b/internal/pipe/checksums/checksums.go index 19c7cb162..d4b7e59be 100644 --- a/internal/pipe/checksums/checksums.go +++ b/internal/pipe/checksums/checksums.go @@ -15,14 +15,14 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Pipe for checksums +// Pipe for checksums. type Pipe struct{} func (Pipe) String() string { return "calculating checksums" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { if ctx.Config.Checksum.NameTemplate == "" { ctx.Config.Checksum.NameTemplate = "{{ .ProjectName }}_{{ .Version }}_checksums.txt" @@ -33,7 +33,7 @@ func (Pipe) Default(ctx *context.Context) error { return nil } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) (err error) { artifactList := ctx.Artifacts.Filter( artifact.Or( @@ -54,12 +54,12 @@ func (Pipe) Run(ctx *context.Context) (err error) { file, err := os.OpenFile( filepath.Join(ctx.Config.Dist, filename), os.O_APPEND|os.O_WRONLY|os.O_CREATE|os.O_TRUNC, - 0444, + 0644, ) if err != nil { return err } - defer file.Close() // nolint: errcheck + defer file.Close() var g = semerrgroup.New(ctx.Parallelism) for _, artifact := range artifactList { diff --git a/internal/pipe/custompublishers/custompublishers.go b/internal/pipe/custompublishers/custompublishers.go index f5943d961..b0b88dd29 100644 --- a/internal/pipe/custompublishers/custompublishers.go +++ b/internal/pipe/custompublishers/custompublishers.go @@ -7,15 +7,15 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Pipe for custom publisher +// Pipe for custom publisher. type Pipe struct{} -// String returns the description of the pipe +// String returns the description of the pipe. func (Pipe) String() string { return "custom publisher" } -// Publish artifacts +// Publish artifacts. func (Pipe) Publish(ctx *context.Context) error { if len(ctx.Config.Publishers) == 0 { return pipe.Skip("publishers section is not configured") diff --git a/internal/pipe/defaults/defaults.go b/internal/pipe/defaults/defaults.go index 47393bfde..18f7101d4 100644 --- a/internal/pipe/defaults/defaults.go +++ b/internal/pipe/defaults/defaults.go @@ -8,14 +8,14 @@ import ( "github.com/goreleaser/goreleaser/pkg/defaults" ) -// Pipe that sets the defaults +// Pipe that sets the defaults. type Pipe struct{} func (Pipe) String() string { return "setting defaults" } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { if ctx.Config.Dist == "" { ctx.Config.Dist = "dist" diff --git a/internal/pipe/dist/dist.go b/internal/pipe/dist/dist.go index 12b71427f..21d96bf1f 100644 --- a/internal/pipe/dist/dist.go +++ b/internal/pipe/dist/dist.go @@ -11,14 +11,14 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Pipe for cleandis +// Pipe for dist. type Pipe struct{} func (Pipe) String() string { return "checking ./dist" } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) (err error) { _, err = os.Stat(ctx.Config.Dist) if os.IsNotExist(err) { diff --git a/internal/pipe/docker/docker.go b/internal/pipe/docker/docker.go index cbaa82db7..ed603e0b2 100644 --- a/internal/pipe/docker/docker.go +++ b/internal/pipe/docker/docker.go @@ -19,17 +19,17 @@ import ( "github.com/pkg/errors" ) -// ErrNoDocker is shown when docker cannot be found in $PATH +// ErrNoDocker is shown when docker cannot be found in $PATH. var ErrNoDocker = errors.New("docker not present in $PATH") -// Pipe for docker +// Pipe for docker. type Pipe struct{} func (Pipe) String() string { return "docker images" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { for i := range ctx.Config.Dockers { var docker = &ctx.Config.Dockers[i] @@ -61,7 +61,7 @@ func (Pipe) Default(ctx *context.Context) error { return nil } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { if len(ctx.Config.Dockers) == 0 || len(ctx.Config.Dockers[0].ImageTemplates) == 0 { return pipe.Skip("docker section is not configured") @@ -73,7 +73,7 @@ func (Pipe) Run(ctx *context.Context) error { return doRun(ctx) } -// Publish the docker images +// Publish the docker images. func (Pipe) Publish(ctx *context.Context) error { if ctx.SkipPublish { return pipe.ErrSkipPublishEnabled @@ -227,7 +227,7 @@ func processBuildFlagTemplates(ctx *context.Context, docker config.Docker) ([]st return buildFlags, nil } -// walks the src, recreating dirs and hard-linking files +// walks the src, recreating dirs and hard-linking files. func link(src, dest string) error { return filepath.Walk(src, func(path string, info os.FileInfo, err error) error { if err != nil { diff --git a/internal/pipe/effectiveconfig/config.go b/internal/pipe/effectiveconfig/config.go index 95f5d6ffa..302851d6e 100644 --- a/internal/pipe/effectiveconfig/config.go +++ b/internal/pipe/effectiveconfig/config.go @@ -9,7 +9,7 @@ import ( yaml "gopkg.in/yaml.v2" ) -// Pipe that writes the effective config file to dist +// Pipe that writes the effective config file to dist. type Pipe struct { } @@ -17,7 +17,7 @@ func (Pipe) String() string { return "writing effective config file" } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) (err error) { var path = filepath.Join(ctx.Config.Dist, "config.yaml") bts, err := yaml.Marshal(ctx.Config) @@ -25,5 +25,5 @@ func (Pipe) Run(ctx *context.Context) (err error) { return err } log.WithField("config", path).Info("writing") - return ioutil.WriteFile(path, bts, 0644) + return ioutil.WriteFile(path, bts, 0644) //nolint: gosec } diff --git a/internal/pipe/env/env.go b/internal/pipe/env/env.go index 0c505d56c..f6c8cf829 100644 --- a/internal/pipe/env/env.go +++ b/internal/pipe/env/env.go @@ -12,14 +12,14 @@ import ( "github.com/pkg/errors" ) -// ErrMissingToken indicates an error when GITHUB_TOKEN, GITLAB_TOKEN and GITEA_TOKEN are all missing in the environment +// ErrMissingToken indicates an error when GITHUB_TOKEN, GITLAB_TOKEN and GITEA_TOKEN are all missing in the environment. var ErrMissingToken = errors.New("missing GITHUB_TOKEN, GITLAB_TOKEN and GITEA_TOKEN") -// ErrMultipleTokens indicates that multiple tokens are defined. ATM only one of them if allowed +// ErrMultipleTokens indicates that multiple tokens are defined. ATM only one of them if allowed. // See https://github.com/goreleaser/goreleaser/pull/809 var ErrMultipleTokens = errors.New("multiple tokens defined. Only one is allowed") -// Pipe for env +// Pipe for env. type Pipe struct{} func (Pipe) String() string { @@ -39,7 +39,7 @@ func setDefaultTokenFiles(ctx *context.Context) { } } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { setDefaultTokenFiles(ctx) githubToken, githubTokenErr := loadEnv("GITHUB_TOKEN", ctx.Config.EnvFiles.GitHubToken) diff --git a/internal/pipe/git/errors.go b/internal/pipe/git/errors.go index 13dfb5686..e4360f5a1 100644 --- a/internal/pipe/git/errors.go +++ b/internal/pipe/git/errors.go @@ -5,7 +5,7 @@ import ( "fmt" ) -// ErrDirty happens when the repo has uncommitted/unstashed changes +// ErrDirty happens when the repo has uncommitted/unstashed changes. type ErrDirty struct { status string } @@ -14,7 +14,7 @@ func (e ErrDirty) Error() string { return fmt.Sprintf("git is currently in a dirty state, please check in your pipeline what can be changing the following files:\n%v", e.status) } -// ErrWrongRef happens when the HEAD reference is different from the tag being built +// ErrWrongRef happens when the HEAD reference is different from the tag being built. type ErrWrongRef struct { commit, tag string } diff --git a/internal/pipe/git/git.go b/internal/pipe/git/git.go index c354323d2..8bd216224 100644 --- a/internal/pipe/git/git.go +++ b/internal/pipe/git/git.go @@ -13,14 +13,14 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Pipe that sets up git state +// Pipe that sets up git state. type Pipe struct{} func (Pipe) String() string { return "getting and validating git state" } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { if _, err := exec.LookPath("git"); err != nil { return ErrNoGit diff --git a/internal/pipe/nfpm/nfpm.go b/internal/pipe/nfpm/nfpm.go index 32898c68b..86d851ccc 100644 --- a/internal/pipe/nfpm/nfpm.go +++ b/internal/pipe/nfpm/nfpm.go @@ -1,4 +1,4 @@ -// Package nfpm implements the Pipe interface providing NFPM bindings. +// Package nfpm implements the Pipe interface providing nFPM bindings. package nfpm import ( @@ -25,14 +25,14 @@ import ( const defaultNameTemplate = "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" -// Pipe for fpm packaging +// Pipe for nfpm packaging. type Pipe struct{} func (Pipe) String() string { return "linux packages" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { var ids = ids.New("nfpms") for i := range ctx.Config.NFPMs { @@ -62,7 +62,7 @@ func (Pipe) Default(ctx *context.Context) error { return ids.Validate() } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { for _, nfpm := range ctx.Config.NFPMs { if len(nfpm.Formats) == 0 { @@ -189,7 +189,7 @@ func create(ctx *context.Context, fpm config.NFPM, format, arch string, binaries if err != nil { return err } - defer w.Close() // nolint: errcheck + defer w.Close() if err := packager.Package(nfpm.WithDefaults(info), w); err != nil { return errors.Wrap(err, "nfpm failed") } diff --git a/internal/pipe/pipe.go b/internal/pipe/pipe.go index cd02f9681..f4c4feaa8 100644 --- a/internal/pipe/pipe.go +++ b/internal/pipe/pipe.go @@ -17,23 +17,23 @@ var ErrSkipSignEnabled = Skip("artifact signing is disabled") // It means that the part of a Piper that validates some things was not run. var ErrSkipValidateEnabled = Skip("validation is disabled") -// IsSkip returns true if the error is an ErrSkip +// IsSkip returns true if the error is an ErrSkip. func IsSkip(err error) bool { _, ok := err.(ErrSkip) return ok } -// ErrSkip occurs when a pipe is skipped for some reason +// ErrSkip occurs when a pipe is skipped for some reason. type ErrSkip struct { reason string } -// Error implements the error interface. returns the reason the pipe was skipped +// Error implements the error interface. returns the reason the pipe was skipped. func (e ErrSkip) Error() string { return e.reason } -// Skip skips this pipe with the given reason +// Skip skips this pipe with the given reason. func Skip(reason string) ErrSkip { return ErrSkip{reason: reason} } diff --git a/internal/pipe/project/project.go b/internal/pipe/project/project.go index ae73c6447..29ba40225 100644 --- a/internal/pipe/project/project.go +++ b/internal/pipe/project/project.go @@ -7,14 +7,14 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Pipe implemens defaulter to set the project name +// Pipe implemens defaulter to set the project name. type Pipe struct{} func (Pipe) String() string { return "project name" } -// Default set project defaults +// Default set project defaults. func (Pipe) Default(ctx *context.Context) error { if ctx.Config.ProjectName == "" { switch { diff --git a/internal/pipe/publish/publish.go b/internal/pipe/publish/publish.go index 45f33e965..ffee7dbac 100644 --- a/internal/pipe/publish/publish.go +++ b/internal/pipe/publish/publish.go @@ -18,14 +18,14 @@ import ( "github.com/pkg/errors" ) -// Pipe that publishes artifacts +// Pipe that publishes artifacts. type Pipe struct{} func (Pipe) String() string { return "publishing" } -// Publisher should be implemented by pipes that want to publish artifacts +// Publisher should be implemented by pipes that want to publish artifacts. type Publisher interface { fmt.Stringer @@ -48,7 +48,7 @@ var publishers = []Publisher{ scoop.Pipe{}, } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { for _, publisher := range publishers { if err := middleware.Logging( diff --git a/internal/pipe/release/release.go b/internal/pipe/release/release.go index ae94aa27f..80ecebf54 100644 --- a/internal/pipe/release/release.go +++ b/internal/pipe/release/release.go @@ -14,18 +14,18 @@ import ( "github.com/pkg/errors" ) -// ErrMultipleReleases indicates that multiple releases are defined. ATM only one of them is allowed +// ErrMultipleReleases indicates that multiple releases are defined. ATM only one of them is allowed. // See https://github.com/goreleaser/goreleaser/pull/809 var ErrMultipleReleases = errors.New("multiple releases are defined. Only one is allowed") -// Pipe for github release +// Pipe for github release. type Pipe struct{} func (Pipe) String() string { return "github/gitlab/gitea releases" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { numOfReleases := 0 if ctx.Config.Release.GitHub.String() != "" { @@ -96,7 +96,7 @@ func (Pipe) Default(ctx *context.Context) error { return nil } -// Publish github release +// Publish the release. func (Pipe) Publish(ctx *context.Context) error { if ctx.SkipPublish { return pipe.ErrSkipPublishEnabled @@ -173,7 +173,7 @@ func upload(ctx *context.Context, cli client.Client, releaseID string, artifact if err != nil { return err } - defer file.Close() // nolint: errcheck + defer file.Close() log.WithField("file", file.Name()).WithField("name", artifact.Name).Info("uploading to release") if err := cli.Upload(ctx, releaseID, artifact, file); err != nil { log.WithField("try", try). diff --git a/internal/pipe/scoop/scoop.go b/internal/pipe/scoop/scoop.go index 35f26c728..592674354 100644 --- a/internal/pipe/scoop/scoop.go +++ b/internal/pipe/scoop/scoop.go @@ -17,20 +17,20 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// ErrNoWindows when there is no build for windows (goos doesn't contain windows) +// ErrNoWindows when there is no build for windows (goos doesn't contain windows). var ErrNoWindows = errors.New("scoop requires a windows build") -// ErrTokenTypeNotImplementedForScoop indicates that a new token type was not implemented for this pipe +// ErrTokenTypeNotImplementedForScoop indicates that a new token type was not implemented for this pipe. var ErrTokenTypeNotImplementedForScoop = errors.New("token type not implemented for scoop pipe") -// Pipe for build +// Pipe for build. type Pipe struct{} func (Pipe) String() string { return "scoop manifests" } -// Publish scoop manifest +// Publish scoop manifest. func (Pipe) Publish(ctx *context.Context) error { if ctx.SkipPublish { return pipe.ErrSkipPublishEnabled @@ -42,7 +42,7 @@ func (Pipe) Publish(ctx *context.Context) error { return doRun(ctx, client) } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { if ctx.Config.Scoop.Name == "" { ctx.Config.Scoop.Name = ctx.Config.ProjectName @@ -125,8 +125,8 @@ func doRun(ctx *context.Context, client client.Client) error { ) } -// Manifest represents a scoop.sh App Manifest, more info: -// https://github.com/lukesampson/scoop/wiki/App-Manifests +// Manifest represents a scoop.sh App Manifest. +// more info: https://github.com/lukesampson/scoop/wiki/App-Manifests type Manifest struct { Version string `json:"version"` // The version of the app that this manifest installs. Architecture map[string]Resource `json:"architecture"` // `architecture`: If the app has 32- and 64-bit versions, architecture can be used to wrap the differences. @@ -136,7 +136,7 @@ type Manifest struct { Persist []string `json:"persist,omitempty"` // Persist data between updates } -// Resource represents a combination of a url and a binary name for an architecture +// Resource represents a combination of a url and a binary name for an architecture. type Resource struct { URL string `json:"url"` // URL to the archive Bin []string `json:"bin"` // name of binary inside the archive diff --git a/internal/pipe/semver/semver.go b/internal/pipe/semver/semver.go index c02a9fa2f..0cec8b25a 100644 --- a/internal/pipe/semver/semver.go +++ b/internal/pipe/semver/semver.go @@ -8,15 +8,15 @@ import ( "github.com/pkg/errors" ) -// Pipe is a global hook pipe +// Pipe is a global hook pipe. type Pipe struct{} -// String is the name of this pipe +// String is the name of this pipe. func (Pipe) String() string { return "parsing tag" } -// Run executes the hooks +// Run executes the hooks. func (Pipe) Run(ctx *context.Context) error { sv, err := semver.NewVersion(ctx.Git.CurrentTag) if err != nil { diff --git a/internal/pipe/snapcraft/snapcraft.go b/internal/pipe/snapcraft/snapcraft.go index b0bcdc3dd..e90eaa779 100644 --- a/internal/pipe/snapcraft/snapcraft.go +++ b/internal/pipe/snapcraft/snapcraft.go @@ -23,16 +23,16 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// ErrNoSnapcraft is shown when snapcraft cannot be found in $PATH +// ErrNoSnapcraft is shown when snapcraft cannot be found in $PATH. var ErrNoSnapcraft = errors.New("snapcraft not present in $PATH") -// ErrNoDescription is shown when no description provided +// ErrNoDescription is shown when no description provided. var ErrNoDescription = errors.New("no description provided for snapcraft") -// ErrNoSummary is shown when no summary provided +// ErrNoSummary is shown when no summary provided. var ErrNoSummary = errors.New("no summary provided for snapcraft") -// Metadata to generate the snap package +// Metadata to generate the snap package. type Metadata struct { Name string Version string @@ -47,7 +47,7 @@ type Metadata struct { Plugs map[string]interface{} `yaml:",omitempty"` } -// AppMetadata for the binaries that will be in the snap package +// AppMetadata for the binaries that will be in the snap package. type AppMetadata struct { Command string Plugs []string `yaml:",omitempty"` @@ -57,14 +57,14 @@ type AppMetadata struct { const defaultNameTemplate = "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" -// Pipe for snapcraft packaging +// Pipe for snapcraft packaging. type Pipe struct{} func (Pipe) String() string { return "snapcraft packages" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { var ids = ids.New("snapcrafts") for i := range ctx.Config.Snapcrafts { @@ -82,7 +82,7 @@ func (Pipe) Default(ctx *context.Context) error { return ids.Validate() } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) error { for _, snap := range ctx.Config.Snapcrafts { // TODO: deal with pipe.skip? @@ -139,7 +139,7 @@ func isValidArch(arch string) bool { return false } -// Publish packages +// Publish packages. func (Pipe) Publish(ctx *context.Context) error { if ctx.SkipPublish { return pipe.ErrSkipPublishEnabled @@ -253,7 +253,7 @@ func create(ctx *context.Context, snap config.Snapcraft, arch string, binaries [ if err := os.Link(config.Completer, destCompleterPath); err != nil { return errors.Wrap(err, "failed to link completer") } - if err := os.Chmod(destCompleterPath, 0444); err != nil { + if err := os.Chmod(destCompleterPath, 0644); err != nil { return errors.Wrap(err, "failed to change completer permissions") } appMetadata.Completer = config.Completer @@ -270,7 +270,7 @@ func create(ctx *context.Context, snap config.Snapcraft, arch string, binaries [ } log.WithField("file", file).Debugf("writing metadata file") - if err = ioutil.WriteFile(file, out, 0644); err != nil { + if err = ioutil.WriteFile(file, out, 0644); err != nil { //nolint: gosec return err } diff --git a/internal/pipe/snapshot/snapshot.go b/internal/pipe/snapshot/snapshot.go index 36cce45b7..2def91848 100644 --- a/internal/pipe/snapshot/snapshot.go +++ b/internal/pipe/snapshot/snapshot.go @@ -10,14 +10,14 @@ import ( "github.com/pkg/errors" ) -// Pipe for checksums +// Pipe for checksums. type Pipe struct{} func (Pipe) String() string { return "snapshotting" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { if ctx.Config.Snapshot.NameTemplate == "" { ctx.Config.Snapshot.NameTemplate = "{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}" diff --git a/internal/pipe/sourcearchive/source.go b/internal/pipe/sourcearchive/source.go index d728384f7..2e3d7a537 100644 --- a/internal/pipe/sourcearchive/source.go +++ b/internal/pipe/sourcearchive/source.go @@ -12,14 +12,14 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Pipe for cleandis +// Pipe for source archive. type Pipe struct{} func (Pipe) String() string { return "creating source archive" } -// Run the pipe +// Run the pipe. func (Pipe) Run(ctx *context.Context) (err error) { if !ctx.Config.Source.Enabled { return pipe.Skip("source pipe is disabled") @@ -45,7 +45,7 @@ func (Pipe) Run(ctx *context.Context) (err error) { return err } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { var archive = &ctx.Config.Source if archive.Format == "" { diff --git a/internal/pipe/upload/upload.go b/internal/pipe/upload/upload.go index 5f50710c4..b1499d502 100644 --- a/internal/pipe/upload/upload.go +++ b/internal/pipe/upload/upload.go @@ -1,4 +1,4 @@ -// Package upload provides a Pipe that push using HTTP +// Package upload provides a Pipe that push using HTTP. package upload import ( @@ -10,20 +10,20 @@ import ( "github.com/pkg/errors" ) -// Pipe for http publishing +// Pipe for http publishing. type Pipe struct{} -// String returns the description of the pipe +// String returns the description of the pipe. func (Pipe) String() string { return "http upload" } -// Default sets the pipe defaults +// Default sets the pipe defaults. func (Pipe) Default(ctx *context.Context) error { return http.Defaults(ctx.Config.Uploads) } -// Publish artifacts +// Publish artifacts. func (Pipe) Publish(ctx *context.Context) error { if len(ctx.Config.Uploads) == 0 { return pipe.Skip("uploads section is not configured") diff --git a/internal/semerrgroup/sem.go b/internal/semerrgroup/sem.go index 806c529d8..6a4647019 100644 --- a/internal/semerrgroup/sem.go +++ b/internal/semerrgroup/sem.go @@ -9,7 +9,7 @@ import ( "golang.org/x/sync/errgroup" ) -// Group is the Semphore ErrorGroup itself +// Group is the Semphore ErrorGroup itself. type Group interface { Go(func() error) Wait() error diff --git a/internal/testlib/git.go b/internal/testlib/git.go index 2f83d9151..ea89534cd 100644 --- a/internal/testlib/git.go +++ b/internal/testlib/git.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" ) -// GitInit inits a new git project +// GitInit inits a new git project. func GitInit(t *testing.T) { out, err := fakeGit("init") assert.NoError(t, err) @@ -15,28 +15,28 @@ func GitInit(t *testing.T) { assert.NoError(t, err) } -// GitRemoteAdd adds the given url as remote +// GitRemoteAdd adds the given url as remote. func GitRemoteAdd(t *testing.T, url string) { out, err := fakeGit("remote", "add", "origin", url) assert.NoError(t, err) assert.Empty(t, out) } -// GitCommit creates a git commits +// GitCommit creates a git commits. func GitCommit(t *testing.T, msg string) { out, err := fakeGit("commit", "--allow-empty", "-m", msg) assert.NoError(t, err) assert.Contains(t, out, "master", msg) } -// GitTag creates a git tag +// GitTag creates a git tag. func GitTag(t *testing.T, tag string) { out, err := fakeGit("tag", tag) assert.NoError(t, err) assert.Empty(t, out) } -// GitAdd adds all files to stage +// GitAdd adds all files to stage. func GitAdd(t *testing.T) { out, err := fakeGit("add", "-A") assert.NoError(t, err) diff --git a/internal/testlib/skip.go b/internal/testlib/skip.go index 61200143f..638b6700d 100644 --- a/internal/testlib/skip.go +++ b/internal/testlib/skip.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" ) -// AssertSkipped asserts that a pipe was skipped +// AssertSkipped asserts that a pipe was skipped. func AssertSkipped(t *testing.T, err error) { _, ok := err.(pipe.ErrSkip) assert.True(t, ok, "expected a pipe.ErrSkip but got %v", err) diff --git a/internal/tmpl/tmpl.go b/internal/tmpl/tmpl.go index 1202a01bb..78b93757f 100644 --- a/internal/tmpl/tmpl.go +++ b/internal/tmpl/tmpl.go @@ -1,4 +1,4 @@ -// Package tmpl provides templating utilities for goreleser +// Package tmpl provides templating utilities for goreleaser. package tmpl import ( @@ -14,7 +14,7 @@ import ( "github.com/goreleaser/goreleaser/pkg/context" ) -// Template holds data that can be applied to a template string +// Template holds data that can be applied to a template string. type Template struct { fields Fields } @@ -60,7 +60,7 @@ const ( target = "Target" ) -// New Template +// New Template. func New(ctx *context.Context) *Template { sv := ctx.Semver rawVersionV := fmt.Sprintf("%d.%d.%d", sv.Major, sv.Minor, sv.Patch) @@ -88,7 +88,7 @@ func New(ctx *context.Context) *Template { } // WithEnvS overrides template's env field with the given KEY=VALUE list of -// environment variables +// environment variables. func (t *Template) WithEnvS(envs []string) *Template { var result = map[string]string{} for _, env := range envs { @@ -98,7 +98,7 @@ func (t *Template) WithEnvS(envs []string) *Template { return t.WithEnv(result) } -// WithEnv overrides template's env field with the given environment map +// WithEnv overrides template's env field with the given environment map. func (t *Template) WithEnv(e map[string]string) *Template { t.fields[env] = e return t @@ -113,7 +113,7 @@ func (t *Template) WithExtraFields(f Fields) *Template { return t } -// WithArtifact populates Fields from the artifact and replacements +// WithArtifact populates Fields from the artifact and replacements. func (t *Template) WithArtifact(a *artifact.Artifact, replacements map[string]string) *Template { var bin = a.Extra[binary] if bin == nil { diff --git a/pkg/archive/gzip/gzip.go b/pkg/archive/gzip/gzip.go index dc2c1945c..2bcef3d3e 100644 --- a/pkg/archive/gzip/gzip.go +++ b/pkg/archive/gzip/gzip.go @@ -9,17 +9,17 @@ import ( "os" ) -// Archive as gz +// Archive as gz. type Archive struct { gw *gzip.Writer } -// Close all closeables +// Close all closeables. func (a Archive) Close() error { return a.gw.Close() } -// New gz archive +// New gz archive. func New(target io.Writer) Archive { // the error will be nil since the compression level is valid gw, _ := gzip.NewWriterLevel(target, gzip.BestCompression) @@ -28,7 +28,7 @@ func New(target io.Writer) Archive { } } -// Add file to the archive +// Add file to the archive. func (a Archive) Add(name, path string) error { if a.gw.Header.Name != "" { return fmt.Errorf("gzip: failed to add %s, only one file can be archived in gz format", name) @@ -37,7 +37,7 @@ func (a Archive) Add(name, path string) error { if err != nil { return err } - defer file.Close() // nolint: errcheck + defer file.Close() info, err := file.Stat() if err != nil { return err diff --git a/pkg/archive/targz/targz.go b/pkg/archive/targz/targz.go index 7ea3f41bd..add188880 100644 --- a/pkg/archive/targz/targz.go +++ b/pkg/archive/targz/targz.go @@ -9,13 +9,13 @@ import ( "os" ) -// Archive as tar.gz +// Archive as tar.gz. type Archive struct { gw *gzip.Writer tw *tar.Writer } -// Close all closeables +// Close all closeables. func (a Archive) Close() error { if err := a.tw.Close(); err != nil { return err @@ -23,7 +23,7 @@ func (a Archive) Close() error { return a.gw.Close() } -// New tar.gz archive +// New tar.gz archive. func New(target io.Writer) Archive { // the error will be nil since the compression level is valid gw, _ := gzip.NewWriterLevel(target, gzip.BestCompression) @@ -34,13 +34,13 @@ func New(target io.Writer) Archive { } } -// Add file to the archive +// Add file to the archive. func (a Archive) Add(name, path string) error { file, err := os.Open(path) // #nosec if err != nil { return err } - defer file.Close() // nolint: errcheck + defer file.Close() info, err := file.Stat() if err != nil { return err diff --git a/pkg/archive/tarxz/tarxz.go b/pkg/archive/tarxz/tarxz.go index 21fc98a14..5d6b827f9 100644 --- a/pkg/archive/tarxz/tarxz.go +++ b/pkg/archive/tarxz/tarxz.go @@ -10,13 +10,13 @@ import ( "github.com/ulikunitz/xz" ) -// Archive as tar.xz +// Archive as tar.xz. type Archive struct { xzw *xz.Writer tw *tar.Writer } -// Close all closeables +// Close all closeables. func (a Archive) Close() error { if err := a.tw.Close(); err != nil { return err @@ -24,7 +24,7 @@ func (a Archive) Close() error { return a.xzw.Close() } -// New tar.xz archive +// New tar.xz archive. func New(target io.Writer) Archive { xzw, _ := xz.WriterConfig{DictCap: 16 * 1024 * 1024}.NewWriter(target) tw := tar.NewWriter(xzw) @@ -34,13 +34,13 @@ func New(target io.Writer) Archive { } } -// Add file to the archive +// Add file to the archive. func (a Archive) Add(name, path string) error { file, err := os.Open(path) // #nosec if err != nil { return err } - defer file.Close() // nolint: errcheck + defer file.Close() info, err := file.Stat() if err != nil { return err diff --git a/pkg/archive/zip/zip.go b/pkg/archive/zip/zip.go index d1dd5ead7..2aae0419f 100644 --- a/pkg/archive/zip/zip.go +++ b/pkg/archive/zip/zip.go @@ -9,17 +9,17 @@ import ( "os" ) -// Archive zip struct +// Archive zip struct. type Archive struct { z *zip.Writer } -// Close all closeables +// Close all closeables. func (a Archive) Close() error { return a.z.Close() } -// New zip archive +// New zip archive. func New(target io.Writer) Archive { compressor := zip.NewWriter(target) compressor.RegisterCompressor(zip.Deflate, func(out io.Writer) (io.WriteCloser, error) { @@ -30,13 +30,13 @@ func New(target io.Writer) Archive { } } -// Add a file to the zip archive +// Add a file to the zip archive. func (a Archive) Add(name, path string) (err error) { file, err := os.Open(path) // #nosec if err != nil { return } - defer file.Close() // nolint: errcheck + defer file.Close() info, err := file.Stat() if err != nil { return diff --git a/pkg/build/build.go b/pkg/build/build.go index 377b36992..4c4d56cc9 100644 --- a/pkg/build/build.go +++ b/pkg/build/build.go @@ -14,24 +14,24 @@ var ( lock sync.Mutex ) -// Register registers a builder to a given lang +// Register registers a builder to a given lang. func Register(lang string, builder Builder) { lock.Lock() builders[lang] = builder lock.Unlock() } -// For gets the previously registered builder for the given lang +// For gets the previously registered builder for the given lang. func For(lang string) Builder { return builders[lang] } -// Options to be passed down to a builder +// Options to be passed down to a builder. type Options struct { Name, Path, Ext, Target string } -// Builder defines a builder +// Builder defines a builder. type Builder interface { WithDefaults(build config.Build) config.Build Build(ctx *context.Context, build config.Build, options Options) error diff --git a/pkg/config/config.go b/pkg/config/config.go index 20c7af6cc..15cb832ac 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -12,7 +12,7 @@ import ( yaml "gopkg.in/yaml.v2" ) -// GitHubURLs holds the URLs to be used when using github enterprise +// GitHubURLs holds the URLs to be used when using github enterprise. type GitHubURLs struct { API string `yaml:"api,omitempty"` Upload string `yaml:"upload,omitempty"` @@ -20,32 +20,32 @@ type GitHubURLs struct { SkipTLSVerify bool `yaml:"skip_tls_verify,omitempty"` } -// GitLabURLs holds the URLs to be used when using gitlab ce/enterprise +// GitLabURLs holds the URLs to be used when using gitlab ce/enterprise. type GitLabURLs struct { API string `yaml:"api,omitempty"` Download string `yaml:"download,omitempty"` SkipTLSVerify bool `yaml:"skip_tls_verify,omitempty"` } -// GiteaURLs holds the URLs to be used when using gitea +// GiteaURLs holds the URLs to be used when using gitea. type GiteaURLs struct { API string `yaml:"api,omitempty"` SkipTLSVerify bool `yaml:"skip_tls_verify,omitempty"` } -// Repo represents any kind of repo (github, gitlab, etc) +// Repo represents any kind of repo (github, gitlab, etc). type Repo struct { Owner string `yaml:",omitempty"` Name string `yaml:",omitempty"` } -// HomebrewDependency represents Homebrew dependency +// HomebrewDependency represents Homebrew dependency. type HomebrewDependency struct { Name string `yaml:",omitempty"` Type string `yaml:",omitempty"` } -// type alias to prevent stack overflowing in the custom unmarshaler +// type alias to prevent stack overflowing in the custom unmarshaler. type homebrewDependency HomebrewDependency // UnmarshalYAML is a custom unmarshaler that accept brew deps in both the old and new format. @@ -67,7 +67,7 @@ func (a *HomebrewDependency) UnmarshalYAML(unmarshal func(interface{}) error) er return nil } -// String of the repo, e.g. owner/name +// String of the repo, e.g. owner/name. func (r Repo) String() string { if r.Owner == "" && r.Name == "" { return "" @@ -75,7 +75,7 @@ func (r Repo) String() string { return r.Owner + "/" + r.Name } -// Homebrew contains the brew section +// Homebrew contains the brew section. type Homebrew struct { Name string `yaml:",omitempty"` GitHub Repo `yaml:",omitempty"` @@ -99,7 +99,7 @@ type Homebrew struct { Goarm string `yaml:"goarm,omitempty"` } -// Scoop contains the scoop.sh section +// Scoop contains the scoop.sh section. type Scoop struct { Name string `yaml:",omitempty"` Bucket Repo `yaml:",omitempty"` @@ -113,27 +113,27 @@ type Scoop struct { SkipUpload string `yaml:"skip_upload,omitempty"` } -// CommitAuthor is the author of a Git commit +// CommitAuthor is the author of a Git commit. type CommitAuthor struct { Name string `yaml:",omitempty"` Email string `yaml:",omitempty"` } -// Hooks define actions to run before and/or after something +// Hooks define actions to run before and/or after something. type Hooks struct { Pre string `yaml:",omitempty"` Post string `yaml:",omitempty"` } -// IgnoredBuild represents a build ignored by the user +// IgnoredBuild represents a build ignored by the user. type IgnoredBuild struct { Goos, Goarch, Goarm, Gomips string } -// StringArray is a wrapper for an array of strings +// StringArray is a wrapper for an array of strings. type StringArray []string -// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays +// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays. func (a *StringArray) UnmarshalYAML(unmarshal func(interface{}) error) error { var strings []string if err := unmarshal(&strings); err != nil { @@ -148,10 +148,10 @@ func (a *StringArray) UnmarshalYAML(unmarshal func(interface{}) error) error { return nil } -// FlagArray is a wrapper for an array of strings +// FlagArray is a wrapper for an array of strings. type FlagArray []string -// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays +// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays. func (a *FlagArray) UnmarshalYAML(unmarshal func(interface{}) error) error { var flags []string if err := unmarshal(&flags); err != nil { @@ -166,7 +166,7 @@ func (a *FlagArray) UnmarshalYAML(unmarshal func(interface{}) error) error { return nil } -// Build contains the build configuration section +// Build contains the build configuration section. type Build struct { ID string `yaml:",omitempty"` Goos []string `yaml:",omitempty"` @@ -195,7 +195,7 @@ type HookConfig struct { type BuildHooks []BuildHook -// UnmarshalYAML is a custom unmarshaler that allows simplified declaration of single command +// UnmarshalYAML is a custom unmarshaler that allows simplified declaration of single command. func (bhc *BuildHooks) UnmarshalYAML(unmarshal func(interface{}) error) error { var singleCmd string err := unmarshal(&singleCmd) @@ -219,7 +219,7 @@ type BuildHook struct { Env []string `yaml:",omitempty"` } -// UnmarshalYAML is a custom unmarshaler that allows simplified declarations of commands as strings +// UnmarshalYAML is a custom unmarshaler that allows simplified declarations of commands as strings. func (bh *BuildHook) UnmarshalYAML(unmarshal func(interface{}) error) error { var cmd string if err := unmarshal(&cmd); err != nil { @@ -242,7 +242,7 @@ type FormatOverride struct { Format string `yaml:",omitempty"` } -// Archive config used for the archive +// Archive config used for the archive. type Archive struct { ID string `yaml:",omitempty"` Builds []string `yaml:",omitempty"` @@ -254,7 +254,7 @@ type Archive struct { Files []string `yaml:",omitempty"` } -// Release config used for the GitHub/GitLab release +// Release config used for the GitHub/GitLab release. type Release struct { GitHub Repo `yaml:",omitempty"` GitLab Repo `yaml:",omitempty"` @@ -267,12 +267,12 @@ type Release struct { ExtraFiles []ExtraFile `yaml:"extra_files,omitempty"` } -// ExtraFile on a release +// ExtraFile on a release. type ExtraFile struct { Glob string `yaml:"glob,omitempty"` } -// NFPM config +// NFPM config. type NFPM struct { NFPMOverridables `yaml:",inline"` Overrides map[string]NFPMOverridables `yaml:"overrides,omitempty"` @@ -288,7 +288,7 @@ type NFPM struct { Bindir string `yaml:",omitempty"` } -// NFPMScripts is used to specify maintainer scripts +// NFPMScripts is used to specify maintainer scripts. type NFPMScripts struct { PreInstall string `yaml:"preinstall,omitempty"` PostInstall string `yaml:"postinstall,omitempty"` @@ -296,7 +296,7 @@ type NFPMScripts struct { PostRemove string `yaml:"postremove,omitempty"` } -// NFPMOverridables is used to specify per package format settings +// NFPMOverridables is used to specify per package format settings. type NFPMOverridables struct { FileNameTemplate string `yaml:"file_name_template,omitempty"` PackageName string `yaml:"package_name,omitempty"` @@ -313,7 +313,7 @@ type NFPMOverridables struct { Scripts NFPMScripts `yaml:"scripts,omitempty"` } -// Sign config +// Sign config. type Sign struct { ID string `yaml:"id,omitempty"` Cmd string `yaml:"cmd,omitempty"` @@ -323,7 +323,7 @@ type Sign struct { IDs []string `yaml:"ids,omitempty"` } -// SnapcraftAppMetadata for the binaries that will be in the snap package +// SnapcraftAppMetadata for the binaries that will be in the snap package. type SnapcraftAppMetadata struct { Plugs []string Daemon string @@ -331,7 +331,7 @@ type SnapcraftAppMetadata struct { Completer string `yaml:",omitempty"` } -// Snapcraft config +// Snapcraft config. type Snapcraft struct { NameTemplate string `yaml:"name_template,omitempty"` Replacements map[string]string `yaml:",omitempty"` @@ -350,18 +350,18 @@ type Snapcraft struct { Plugs map[string]interface{} `yaml:",omitempty"` } -// Snapshot config +// Snapshot config. type Snapshot struct { NameTemplate string `yaml:"name_template,omitempty"` } -// Checksum config +// Checksum config. type Checksum struct { NameTemplate string `yaml:"name_template,omitempty"` Algorithm string `yaml:"algorithm,omitempty"` } -// Docker image config +// Docker image config. type Docker struct { Binaries []string `yaml:",omitempty"` Builds []string `yaml:",omitempty"` @@ -375,12 +375,12 @@ type Docker struct { BuildFlagTemplates []string `yaml:"build_flag_templates,omitempty"` } -// Filters config +// Filters config. type Filters struct { Exclude []string `yaml:",omitempty"` } -// Changelog Config +// Changelog Config. type Changelog struct { Filters Filters `yaml:",omitempty"` Sort string `yaml:",omitempty"` @@ -388,19 +388,19 @@ type Changelog struct { } // EnvFiles holds paths to files that contains environment variables -// values like the github token for example +// values like the github token for example. type EnvFiles struct { GitHubToken string `yaml:"github_token,omitempty"` GitLabToken string `yaml:"gitlab_token,omitempty"` GiteaToken string `yaml:"gitea_token,omitempty"` } -// Before config +// Before config. type Before struct { Hooks []string `yaml:",omitempty"` } -// Blob contains config for GO CDK blob +// Blob contains config for GO CDK blob. type Blob struct { Bucket string `yaml:",omitempty"` Provider string `yaml:",omitempty"` @@ -413,7 +413,7 @@ type Blob struct { ExtraFiles []ExtraFile `yaml:"extra_files,omitempty"` } -// Upload configuration +// Upload configuration. type Upload struct { Name string `yaml:",omitempty"` IDs []string `yaml:"ids,omitempty"` @@ -428,7 +428,7 @@ type Upload struct { CustomArtifactName bool `yaml:"custom_artifact_name,omitempty"` } -// Publisher configuration +// Publisher configuration. type Publisher struct { Name string `yaml:",omitempty"` IDs []string `yaml:"ids,omitempty"` @@ -439,14 +439,14 @@ type Publisher struct { Env []string `yaml:",omitempty"` } -// Source configuration +// Source configuration. type Source struct { NameTemplate string `yaml:"name_template,omitempty"` Format string `yaml:",omitempty"` Enabled bool `yaml:",omitempty"` } -// Project includes all project configuration +// Project includes all project configuration. type Project struct { ProjectName string `yaml:"project_name,omitempty"` Env []string `yaml:",omitempty"` @@ -484,7 +484,7 @@ type Project struct { GiteaURLs GiteaURLs `yaml:"gitea_urls,omitempty"` } -// Load config file +// Load config file. func Load(file string) (config Project, err error) { f, err := os.Open(file) // #nosec if err != nil { @@ -495,7 +495,7 @@ func Load(file string) (config Project, err error) { return LoadReader(f) } -// LoadReader config via io.Reader +// LoadReader config via io.Reader. func LoadReader(fd io.Reader) (config Project, err error) { data, err := ioutil.ReadAll(fd) if err != nil { diff --git a/pkg/context/context.go b/pkg/context/context.go index 624366eec..063d1a8d0 100644 --- a/pkg/context/context.go +++ b/pkg/context/context.go @@ -16,7 +16,7 @@ import ( "github.com/goreleaser/goreleaser/pkg/config" ) -// GitInfo includes tags and diffs used in some point +// GitInfo includes tags and diffs used in some point. type GitInfo struct { CurrentTag string Commit string @@ -25,7 +25,7 @@ type GitInfo struct { URL string } -// Env is the environment variables +// Env is the environment variables. type Env map[string]string // Copy returns a copy of the environment. @@ -47,19 +47,19 @@ func (e Env) Strings() []string { return result } -// TokenType is either github or gitlab +// TokenType is either github or gitlab. type TokenType string const ( - // TokenTypeGitHub defines github as type of the token + // TokenTypeGitHub defines github as type of the token. TokenTypeGitHub TokenType = "github" - // TokenTypeGitLab defines gitlab as type of the token + // TokenTypeGitLab defines gitlab as type of the token. TokenTypeGitLab TokenType = "gitlab" - // TokenTypeGitea defines gitea as type of the token + // TokenTypeGitea defines gitea as type of the token. TokenTypeGitea TokenType = "gitea" ) -// Context carries along some data through the pipes +// Context carries along some data through the pipes. type Context struct { ctx.Context Config config.Project @@ -85,7 +85,7 @@ type Context struct { Semver Semver } -// Semver represents a semantic version +// Semver represents a semantic version. type Semver struct { Major uint64 Minor uint64 @@ -94,18 +94,18 @@ type Semver struct { Prerelease string } -// New context +// New context. func New(config config.Project) *Context { return Wrap(ctx.Background(), config) } -// NewWithTimeout new context with the given timeout +// NewWithTimeout new context with the given timeout. func NewWithTimeout(config config.Project, timeout time.Duration) (*Context, ctx.CancelFunc) { ctx, cancel := ctx.WithTimeout(ctx.Background(), timeout) return Wrap(ctx, config), cancel } -// Wrap wraps an existing context +// Wrap wraps an existing context. func Wrap(ctx ctx.Context, config config.Project) *Context { return &Context{ Context: ctx,