Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package geoipupdate for openSUSE:Factory checked in at 2022-03-01 17:04:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/geoipupdate (Old) and /work/SRC/openSUSE:Factory/.geoipupdate.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "geoipupdate" Tue Mar 1 17:04:08 2022 rev:19 rq:958302 version:4.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/geoipupdate/geoipupdate.changes 2021-11-09 23:55:10.603969938 +0100 +++ /work/SRC/openSUSE:Factory/.geoipupdate.new.1958/geoipupdate.changes 2022-03-01 17:04:56.572355317 +0100 @@ -1,0 +2,9 @@ +Tue Mar 1 15:20:57 UTC 2022 - Paolo Stivanin <i...@paolostivanin.com> + +- Update to version 4.9.0: + * The client now sets the User-Agent header. + * The error handling has been improved. + * The goreleaser configuration has been consolidated. There is now + one checksum file for all builds. + +------------------------------------------------------------------- Old: ---- geoipupdate-4.8.0.tar.gz New: ---- geoipupdate-4.9.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ geoipupdate.spec ++++++ --- /var/tmp/diff_new_pack.VnO1dW/_old 2022-03-01 17:04:57.116355461 +0100 +++ /var/tmp/diff_new_pack.VnO1dW/_new 2022-03-01 17:04:57.124355463 +0100 @@ -1,7 +1,7 @@ # # spec file for package geoipupdate # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ # Common info Name: geoipupdate -Version: 4.8.0 +Version: 4.9.0 Release: 0 Summary: GeoIP update client code License: Apache-2.0 OR MIT @@ -55,6 +55,7 @@ + # Preparation step (unpackung and patching if necessary) %prep %setup -q -a1 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.VnO1dW/_old 2022-03-01 17:04:57.176355477 +0100 +++ /var/tmp/diff_new_pack.VnO1dW/_new 2022-03-01 17:04:57.180355478 +0100 @@ -2,7 +2,7 @@ <service name="tar_scm" mode="disabled"> <param name="scm">git</param> <param name="url">git://github.com/maxmind/geoipupdate</param> - <param name="revision">v4.8.0</param> + <param name="revision">v4.9.0</param> <param name="exclude">.git</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.VnO1dW/_old 2022-03-01 17:04:57.200355484 +0100 +++ /var/tmp/diff_new_pack.VnO1dW/_new 2022-03-01 17:04:57.204355485 +0100 @@ -1,7 +1,7 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/maxmind/geoipupdate</param> - <param name="changesrevision">4bf61478cbaf0c0286e7c2f71d0b0f2d473a5ba8</param> + <param name="changesrevision">9b9a5083f52edcbd2e58a5e923eb4101042387e4</param> </service> </servicedata> (No newline at EOF) ++++++ geoipupdate-4.8.0.tar.gz -> geoipupdate-4.9.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/.github/workflows/go.yml new/geoipupdate-4.9.0/.github/workflows/go.yml --- old/geoipupdate-4.8.0/.github/workflows/go.yml 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/.github/workflows/go.yml 2022-02-15 23:25:37.000000000 +0100 @@ -11,7 +11,8 @@ build: strategy: matrix: - go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x] + # I think we need to keep 1.13 for Ubuntu Bionic for the PPA. + go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x] platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} name: "Build ${{ matrix.go-version }} test on ${{ matrix.platform }}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/.golangci.toml new/geoipupdate-4.9.0/.golangci.toml --- old/geoipupdate-4.8.0/.golangci.toml 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/.golangci.toml 2022-02-15 23:25:37.000000000 +0100 @@ -1,28 +1,48 @@ [run] deadline = "10m" + tests = true [linters] disable-all = true enable = [ + "asciicheck", + "bidichk", "bodyclose", + "containedctx", + "contextcheck", "deadcode", "depguard", + "durationcheck", "errcheck", + # Seems to cause stack overflows :-( + # "errchkjson", + "errname", "errorlint", "exhaustive", "exportloopref", + "forbidigo", + # We tried this liner but most places we do forced type asserts are + # pretty safe, e.g., an atomic.Value when everything is encapsulated + # in a small package. + # "forcetypeassert", "goconst", "gocyclo", "gocritic", + "godot", "gofumpt", - "golint", + "gomodguard", "gosec", "gosimple", "govet", + "grouper", "ineffassign", "lll", "makezero", + # Maintainability Index. Seems like it could be a good idea, but a + # lot of things fail and we would need to make some decisions about + # what to allow. + # "maintidx", "misspell", "nakedret", "nilerr", @@ -30,10 +50,14 @@ "nolintlint", "predeclared", "revive", + "rowserrcheck", + # https://github.com/golangci/golangci-lint/issues/287 + # "safesql", "sqlclosecheck", "staticcheck", "structcheck", "stylecheck", + "tenv", "tparallel", "typecheck", "unconvert", @@ -41,6 +65,18 @@ "unused", "varcheck", "vetshadow", + "wastedassign", + "wrapcheck", + ] + +# Please note that we only use depguard for stdlib as gomodguard only +# supports modules currently. See https://github.com/ryancurrah/gomodguard/issues/12 +[linters-settings.depguard] + list-type = "blacklist" + include-go-root = true + packages = [ + # We should use github.com/pkg/errors instead + "errors", ] [linters-settings.errcheck] @@ -49,19 +85,449 @@ # don't actually care about the error. ignore = "Close,fmt:.*" +[linters-settings.errorlint] + errorf = true + asserts = true + comparison = true + [linters-settings.exhaustive] default-signifies-exhaustive = true +[linters-settings.gocritic] + enabled-checks = [ + "appendAssign", + "appendCombine", + "argOrder", + "assignOp", + "badCall", + "badCond", + "badLock", + "badRegexp", + "badSorting", + "boolExprSimplify", + "builtinShadow", + "builtinShadowDecl", + "captLocal", + "caseOrder", + "codegenComment", + "commentedOutCode", + "commentedOutImport", + "commentFormatting", + "defaultCaseOrder", + # Revive's defer rule already captures this. This caught no extra cases. + # "deferInLoop", + "deferUnlambda", + "deprecatedComment", + "docStub", + "dupArg", + "dupBranchBody", + "dupCase", + "dupImport", + "dupSubExpr", + "dynamicFmtString", + "elseif", + "emptyDecl", + "emptyFallthrough", + "emptyStringTest", + "equalFold", + "evalOrder", + "exitAfterDefer", + "exposedSyncMutex", + "externalErrorReassign", + # Given that all of our code runs on Linux and the / separate should + # work fine, this seems less important. + # "filepathJoin", + "flagDeref", + "flagName", + "hexLiteral", + "ifElseChain", + "importShadow", + "indexAlloc", + "initClause", + "mapKey", + "methodExprCall", + "nestingReduce", + "newDeref", + "nilValReturn", + "octalLiteral", + "offBy1", + "paramTypeCombine", + "preferDecodeRune", + "preferFilepathJoin", + "preferFprint", + "preferStringWriter", + "preferWriteByte", + "ptrToRefParam", + "rangeExprCopy", + "rangeValCopy", + "redundantSprint", + "regexpMust", + "regexpPattern", + # This might be good, but I don't think we want to encourage + # significant changes to regexes as we port stuff from Perl. + # "regexpSimplify", + "ruleguard", + "singleCaseSwitch", + "sliceClear", + "sloppyLen", + # This seems like it might also be good, but a lot of existing code + # fails. + # "sloppyReassign", + "returnAfterHttpError", + "sloppyTypeAssert", + "sortSlice", + "sprintfQuotedString", + "sqlQuery", + "stringXbytes", + "switchTrue", + "syncMapLoadAndDelete", + "timeExprSimplify", + "tooManyResultsChecker", + "truncateCmp", + "typeAssertChain", + "typeDefFirst", + "typeSwitchVar", + "typeUnparen", + "underef", + "unlabelStmt", + "unlambda", + # I am not sure we would want this linter and a lot of existing + # code fails. + # "unnamedResult", + "unnecessaryBlock", + "unnecessaryDefer", + "unslice", + "valSwap", + "weakCond", + "wrapperFunc", + "yodaStyleExpr", + # This requires explanations for "nolint" directives. This would be + # nice for gosec ones, but I am not sure we want it generally unless + # we can get the false positive rate lower. + # "whyNoLint" + ] + [linters-settings.gofumpt] extra-rules = true + lang-version = "1.16" + +[linters-settings.gomodguard] + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/avct/uasurfer"] + recommendations = ["github.com/xavivars/uasurfer"] + reason = "The original avct module appears abandoned." + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/BurntSushi/toml"] + recommendations = ["github.com/pelletier/go-toml"] + reason = "This library panics frequently on invalid input." + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/gofrs/uuid"] + recommendations = ["github.com/google/uuid"] + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/satori/go.uuid"] + recommendations = ["github.com/google/uuid"] + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/lib/pq"] + recommendations = ["github.com/jackc/pgx"] + reason = "This library is no longer actively maintained." + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/neilotoole/errgroup"] + recommendations = ["golang.org/x/sync/errgroup"] + reason = "This library can lead to subtle deadlocks in certain use cases." + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/pariz/gountries"] + reason = "This library's data is not actively maintained. Use GeoInfo data." + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/RackSec/srslog"] + recommendations = ["github.com/RackSec/srslog"] + reason = "This library's data is not actively maintained." + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/ua-parser/uap-go/uaparser"] + recommendations = ["github.com/xavivars/uasurfer"] + reason = "The performance of this library is absolutely abysmal." + + [[linters-settings.gomodguard.blocked.modules]] + [linters-settings.gomodguard.blocked.modules."github.com/ugorji/go/codec"] + recommendations = ["encoding/json", "github.com/mailru/easyjson"] + reason = "This library is poorly maintained. We should default to using encoding/json and use easyjson where performance really matters." + + [[linters-settings.gomodguard.blocked.versions]] + [linters-settings.gomodguard.blocked.versions."github.com/jackc/pgx"] + version = "< 4.0.0" + reason = "Use github.com/jackc/pgx/v4" + +[linters-settings.govet] + "enable-all" = true [linters-settings.lll] line-length = 120 tab-width = 4 +[linters-settings.nolintlint] + allow-leading-space = false + allow-unused = false + allow-no-explanation = ["lll", "misspell"] + require-explanation = true + require-specific = true + +[linters-settings.revive] + ignore-generated-header = true + severity = "warning" + + # This might be nice but it is so common that it is hard + # to enable. + # [[linters-settings.revive.rules]] + # name = "add-constant" + + # [[linters-settings.revive.rules]] + # name = "argument-limit" + + [[linters-settings.revive.rules]] + name = "atomic" + + [[linters-settings.revive.rules]] + name = "bare-return" + + [[linters-settings.revive.rules]] + name = "blank-imports" + + [[linters-settings.revive.rules]] + name = "bool-literal-in-expr" + + [[linters-settings.revive.rules]] + name = "call-to-gc" + + # [[linters-settings.revive.rules]] + # name = "cognitive-complexity" + + # Probably a good rule, but we have a lot of names that + # only have case differences. + # [[linters-settings.revive.rules]] + # name = "confusing-naming" + + [[linters-settings.revive.rules]] + name = "confusing-results" + + [[linters-settings.revive.rules]] + name = "constant-logical-expr" + + [[linters-settings.revive.rules]] + name = "context-as-argument" + + [[linters-settings.revive.rules]] + name = "context-keys-type" + + # [[linters-settings.revive.rules]] + # name = "cyclomatic" + + [[linters-settings.revive.rules]] + name = "deep-exit" + + [[linters-settings.revive.rules]] + name = "defer" + + [[linters-settings.revive.rules]] + name = "dot-imports" + + [[linters-settings.revive.rules]] + name = "duplicated-imports" + + [[linters-settings.revive.rules]] + name = "early-return" + + [[linters-settings.revive.rules]] + name = "empty-block" + + [[linters-settings.revive.rules]] + name = "empty-lines" + + [[linters-settings.revive.rules]] + name = "errorf" + + [[linters-settings.revive.rules]] + name = "error-naming" + + [[linters-settings.revive.rules]] + name = "error-return" + + [[linters-settings.revive.rules]] + name = "error-strings" + + [[linters-settings.revive.rules]] + name = "exported" + + # [[linters-settings.revive.rules]] + # name = "file-header" + + # We have a lot of flag parameters. This linter probably makes + # a good point, but we would need some cleanup or a lot of nolints. + # [[linters-settings.revive.rules]] + # name = "flag-parameter" + + # [[linters-settings.revive.rules]] + # name = "function-result-limit" + + [[linters-settings.revive.rules]] + name = "get-return" + + [[linters-settings.revive.rules]] + name = "identical-branches" + + [[linters-settings.revive.rules]] + name = "if-return" + + [[linters-settings.revive.rules]] + name = "imports-blacklist" + + [[linters-settings.revive.rules]] + name = "import-shadowing" + + [[linters-settings.revive.rules]] + name = "increment-decrement" + + [[linters-settings.revive.rules]] + name = "indent-error-flow" + + # [[linters-settings.revive.rules]] + # name = "line-length-limit" + + # [[linters-settings.revive.rules]] + # name = "max-public-structs" + + [[linters-settings.revive.rules]] + name = "modifies-parameter" + + [[linters-settings.revive.rules]] + name = "modifies-value-receiver" + + # We frequently use nested structs, particularly in tests. + # [[linters-settings.revive.rules]] + # name = "nested-structs" + + [[linters-settings.revive.rules]] + name = "optimize-operands-order" + + [[linters-settings.revive.rules]] + name = "package-comments" + + [[linters-settings.revive.rules]] + name = "range" + + [[linters-settings.revive.rules]] + name = "range-val-address" + + [[linters-settings.revive.rules]] + name = "range-val-in-closure" + + [[linters-settings.revive.rules]] + name = "receiver-naming" + + [[linters-settings.revive.rules]] + name = "redefines-builtin-id" + + [[linters-settings.revive.rules]] + name = "string-of-int" + + [[linters-settings.revive.rules]] + name = "struct-tag" + + [[linters-settings.revive.rules]] + name = "superfluous-else" + + [[linters-settings.revive.rules]] + name = "time-naming" + + [[linters-settings.revive.rules]] + name = "unconditional-recursion" + + [[linters-settings.revive.rules]] + name = "unexported-naming" + + [[linters-settings.revive.rules]] + name = "unexported-return" + + # This is covered elsewhere and we want to ignore some + # functions such as fmt.Fprintf. + # [[linters-settings.revive.rules]] + # name = "unhandled-error" + + [[linters-settings.revive.rules]] + name = "unnecessary-stmt" + + [[linters-settings.revive.rules]] + name = "unreachable-code" + + [[linters-settings.revive.rules]] + name = "unused-parameter" + + # We generally have unused receivers in tests for meeting the + # requirements of an interface. + # [[linters-settings.revive.rules]] + # name = "unused-receiver" + + [[linters-settings.revive.rules]] + name = "useless-break" + + [[linters-settings.revive.rules]] + name = "var-declaration" + + [[linters-settings.revive.rules]] + name = "var-naming" + + [[linters-settings.revive.rules]] + name = "waitgroup-by-value" + +[linters-settings.unparam] + check-exported = true + +[linters-settings.wrapcheck] + "ignoreSigs" = [ + ".Errorf(", + "errgroup.NewMultiError(", + "errors.New(", + ".Wait(", + ".WithMessage(", + ".WithMessagef(", + ".WithStack(", + ".Wrap(", + ".Wrapf(", + "v4.Retry(", + "v4.RetryNotify(", + ] + [issues] exclude-use-default = false + # This goes off for MD5 usage, which we use heavily + [[issues.exclude-rules]] + text = "weak cryptographic primitive" + linters = ["gosec"] + + [[issues.exclude-rules]] + linters = [ + "gocritic" + ] + # For some reason the imports stuff in ruleguard doesn't work in golangci-lint. + # Perhaps it has an outdated version or something + path = "_test.go" + text = "ruleguard: Prefer the alternative Context method instead" + + [[issues.exclude-rules]] + linters = [ + "gocritic" + ] + ## The nolintlint linter behaves oddly with ruleguard rules + source = "// *no-ruleguard" + + [[issues.exclude-rules]] linters = [ "gosec" @@ -69,7 +535,64 @@ # G306 - "Expect WriteFile permissions to be 0600 or less". text = "G306" - # This goes off for MD5 usage, which we use heavily [[issues.exclude-rules]] - text = "weak cryptographic primitive" - linters = ["gosec"] + linters = [ + "govet" + ] + # we want to enable almost all govet rules. It is easier to just filter out + # the ones we don't want: + # + # * fieldalignment - way too noisy. Although it is very useful in particular + # cases where we are trying to use as little memory as possible, having + # it go off on every struct isn't helpful. + # * shadow - although often useful, it complains about _many_ err + # shadowing assignments and some others where shadowing is clear. + text = "^(fieldalignment|shadow)" + + [[issues.exclude-rules]] + linters = [ + "govet" + ] + text = "shadow: declaration of \"err\" shadows declaration" + + [[issues.exclude-rules]] + linters = [ + "contextcheck", + "nilerr", + "wrapcheck", + ] + path = "_test.go" + + [[issues.exclude-rules]] + linters = [ + "stylecheck", + ] + # ST1016 - methods on the same type should have the same receiver name. + # easyjson doesn't interact well with this. + text = "ST1016" + + [[issues.exclude-rules]] + linters = [ + "staticcheck", + ] + # SA5008: unknown JSON option "intern" - easyjson specific option. + text = 'SA5008: unknown JSON option "intern"' + + [[issues.exclude-rules]] + linters = [ + "wrapcheck" + ] + text = "github.com/maxmind/geoipupdate" + + [[issues.exclude-rules]] + linters = [ + "wrapcheck", + ] + path = "_easyjson.go" + + [[issues.exclude-rules]] + linters = [ + "gocritic", + ] + source = "Chmod|WriteFile" + text = "octalLiteral" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/.goreleaser-packages.yml new/geoipupdate-4.9.0/.goreleaser-packages.yml --- old/geoipupdate-4.8.0/.goreleaser-packages.yml 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/.goreleaser-packages.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,57 +0,0 @@ -project_name: 'geoipupdate' -archives: - - id: main - wrap_in_directory: true - files: - - 'CHANGELOG.md' - - 'LICENSE-APACHE' - - 'LICENSE-MIT' - - 'README.md' - - 'GeoIP.conf' - - 'GeoIP.conf.md' - - 'geoipupdate.md' -builds: - - main: './cmd/geoipupdate' - binary: 'geoipupdate' - goarch: - - '386' - - 'amd64' - - 'arm' - - 'arm64' - goos: - - 'linux' - hooks: - post: 'make data BUILDDIR=. CONFFILE=/etc/GeoIP.conf DATADIR=/usr/share/GeoIP' - ldflags: - - '-s -w -X main.version={{.Version}} -X main.defaultConfigFile=/etc/GeoIP.conf -X main.defaultDatabaseDirectory=/usr/share/GeoIP' - env: - - CGO_ENABLED=0 -checksum: - name_template: 'checksums-dpkg-rpm.txt' -nfpms: - - vendor: 'MaxMind, Inc.' - homepage: https://www.maxmind.com/ - maintainer: 'MaxMind, Inc. <supp...@maxmind.com>' - description: Program to perform automatic updates of GeoIP2 and GeoIP Legacy binary databases. - license: Apache 2.0 or MIT - formats: - - deb - - rpm - bindir: /usr/bin - empty_folders: - - /usr/share/GeoIP - files: - 'CHANGELOG.md': '/usr/share/doc/geoipupdate/CHANGELOG.md' - 'LICENSE-APACHE': '/usr/share/doc/geoipupdate/LICENSE-APACHE' - 'LICENSE-MIT': '/usr/share/doc/geoipupdate/LICENSE-MIT' - 'README.md': '/usr/share/doc/geoipupdate/README.md' - 'GeoIP.conf': '/usr/share/doc/geoipupdate/GeoIP.conf' - 'GeoIP.conf.md': '/usr/share/doc/geoipupdate/GeoIP.conf.md' - 'geoipupdate.md': '/usr/share/doc/geoipupdate/geoipupdate.md' - config_files: - 'GeoIP.conf': '/etc/GeoIP.conf' -release: - # We disable the release as there is no way to disable the creation of - # the archive version and we don't want to upload those. We also can - # only do one release. - disable: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/.goreleaser-windows.yml new/geoipupdate-4.9.0/.goreleaser-windows.yml --- old/geoipupdate-4.8.0/.goreleaser-windows.yml 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/.goreleaser-windows.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -project_name: 'geoipupdate' -archives: - - id: main - wrap_in_directory: true - files: - - 'CHANGELOG.md' - - 'LICENSE-APACHE' - - 'LICENSE-MIT' - - 'README.md' - - 'GeoIP.conf' - - 'GeoIP.conf.md' - - 'geoipupdate.md' - format: zip -builds: - - main: './cmd/geoipupdate' - binary: 'geoipupdate' - goarch: - - '386' - - 'amd64' - goos: - - 'windows' - hooks: - post: 'make data OS=Windows_NT BUILDDIR=.' - env: - - CGO_ENABLED=0 -checksum: - name_template: 'checksums-windows.txt' -release: - # We can only do one release. - disable: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/.goreleaser.yml new/geoipupdate-4.9.0/.goreleaser.yml --- old/geoipupdate-4.8.0/.goreleaser.yml 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/.goreleaser.yml 2022-02-15 23:25:37.000000000 +0100 @@ -1,17 +1,33 @@ project_name: 'geoipupdate' archives: - - id: main + - id: 'archives-unix' + builds: + - 'geoipupdate-unix' wrap_in_directory: true files: - 'CHANGELOG.md' - 'LICENSE-APACHE' - 'LICENSE-MIT' - 'README.md' - - 'GeoIP.conf' - - 'GeoIP.conf.md' - - 'geoipupdate.md' + - src: 'build/unix/*' + dst: '.' + strip_parent: true + - id: 'archives-windows' + builds: + - 'geoipupdate-windows' + wrap_in_directory: true + files: + - 'CHANGELOG.md' + - 'LICENSE-APACHE' + - 'LICENSE-MIT' + - 'README.md' + - src: 'build/windows/*' + dst: '.' + strip_parent: true + format: 'zip' builds: - - main: './cmd/geoipupdate' + - id: 'geoipupdate-unix' + main: './cmd/geoipupdate' binary: 'geoipupdate' goarch: - '386' @@ -21,15 +37,58 @@ goos: - 'darwin' - 'linux' + - 'freebsd' + - 'openbsd' + ignore: + - goos: freebsd + goarch: arm + - goos: openbsd + goarch: arm + - goos: freebsd + goarch: arm64 + - goos: openbsd + goarch: arm64 hooks: - post: 'make data BUILDDIR=.' + post: 'make data BUILDDIR="build/unix"' + env: + - CGO_ENABLED=0 + # This is a separate build as we want to specify different paths in the + # ldflags. + - id: 'geoipupdate-packages' + main: './cmd/geoipupdate' + binary: 'geoipupdate' + goarch: + - '386' + - 'amd64' + - 'arm' + - 'arm64' + goos: + - 'linux' + hooks: + post: 'make data BUILDDIR="build/packages" CONFFILE=/etc/GeoIP.conf DATADIR=/usr/share/GeoIP' + ldflags: + - '-s -w -X main.version={{.Version}} -X main.defaultConfigFile=/etc/GeoIP.conf -X main.defaultDatabaseDirectory=/usr/share/GeoIP' + env: + - CGO_ENABLED=0 + - id: 'geoipupdate-windows' + main: './cmd/geoipupdate' + binary: 'geoipupdate' + goarch: + - '386' + - 'amd64' + goos: + - 'windows' + hooks: + post: 'make data OS=Windows_NT BUILDDIR="build/windows"' env: - CGO_ENABLED=0 dockers: - - image_templates: + - ids: + - 'geoipupdate-unix' + image_templates: - "maxmindinc/geoipupdate:{{ .Tag }}-amd64" dockerfile: docker/Dockerfile - use_buildx: true + use: buildx goarch: amd64 extra_files: - docker/entry.sh @@ -38,7 +97,7 @@ - image_templates: - "maxmindinc/geoipupdate:{{ .Tag }}-arm64" dockerfile: docker/Dockerfile - use_buildx: true + use: buildx goarch: arm64 extra_files: - docker/entry.sh @@ -47,7 +106,7 @@ - image_templates: - "maxmindinc/geoipupdate:{{ .Tag }}-arm-v6" dockerfile: docker/Dockerfile - use_buildx: true + use: buildx goarch: arm goarm: 6 extra_files: @@ -75,5 +134,39 @@ - "maxmindinc/geoipupdate:{{ .Tag }}-amd64" - "maxmindinc/geoipupdate:{{ .Tag }}-arm64" - "maxmindinc/geoipupdate:{{ .Tag }}-arm-v6" -checksum: - name_template: 'checksums-darwin-linux.txt' +nfpms: + - builds: + - 'geoipupdate-packages' + vendor: 'MaxMind, Inc.' + homepage: https://www.maxmind.com/ + maintainer: 'MaxMind, Inc. <supp...@maxmind.com>' + description: Program to perform automatic updates of GeoIP2 and GeoIP Legacy binary databases. + license: Apache 2.0 or MIT + formats: + - deb + - rpm + bindir: /usr/bin + contents: + - dst: /usr/share/GeoIP + type: 'dir' + - src: 'CHANGELOG.md' + dst: '/usr/share/doc/geoipupdate/CHANGELOG.md' + - src: 'LICENSE-APACHE' + dst: '/usr/share/doc/geoipupdate/LICENSE-APACHE' + - src: 'LICENSE-MIT' + dst: '/usr/share/doc/geoipupdate/LICENSE-MIT' + - src: 'README.md' + dst: '/usr/share/doc/geoipupdate/README.md' + - src: 'build/packages/GeoIP.conf' + dst: '/usr/share/doc/geoipupdate/GeoIP.conf' + - src: 'build/packages/GeoIP.conf.md' + dst: '/usr/share/doc/geoipupdate/GeoIP.conf.md' + - src: 'build/packages/geoipupdate.md' + dst: '/usr/share/doc/geoipupdate/geoipupdate.md' + - src: 'build/packages/GeoIP.conf.5' + dst: '/usr/share/man/man5/GeoIP.conf.5' + - src: 'build/packages/geoipupdate.1' + dst: '/usr/share/man/man1/geoipupdate.1' + - src: 'build/packages/GeoIP.conf' + dst: '/etc/GeoIP.conf' + type: config diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/CHANGELOG.md new/geoipupdate-4.9.0/CHANGELOG.md --- old/geoipupdate-4.8.0/CHANGELOG.md 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/CHANGELOG.md 2022-02-15 23:25:37.000000000 +0100 @@ -1,6 +1,6 @@ # CHANGELOG -## 4.8.0 +## 4.8.0 (2021-07-20) * The Docker container now supports the following new environment variables: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/README.md new/geoipupdate-4.9.0/README.md --- old/geoipupdate-4.8.0/README.md 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/README.md 2022-02-15 23:25:37.000000000 +0100 @@ -14,11 +14,11 @@ latest release. After you install geoipupdate, please refer to our -[documentation](https://dev.maxmind.com/geoip/geoipupdate/) for information +[documentation](https://dev.maxmind.com/geoip/updating-databases?lang=en) for information about configuration. If you're upgrading from geoipupdate 3.x, please see our [upgrade -guide](https://dev.maxmind.com/geoip/geoipupdate/upgrading-to-geoip-update-4-x/). +guide](https://dev.maxmind.com/geoip/upgrading-geoip-update?lang=en). ### Installing on Linux via the tarball @@ -117,7 +117,7 @@ # Configuring -Please see our [online guide](https://dev.maxmind.com/geoip/geoipupdate/) for +Please see our [online guide](https://dev.maxmind.com/geoip/updating-databases?lang=en) for directions on how to configure GeoIP Update. # Documentation @@ -141,7 +141,7 @@ # Copyright and License -This software is Copyright (c) 2018 - 2020 by MaxMind, Inc. +This software is Copyright (c) 2018 - 2022 by MaxMind, Inc. This is free software, licensed under the [Apache License, Version 2.0](LICENSE-APACHE) or the [MIT License](LICENSE-MIT), at your option. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/_layouts/default.html new/geoipupdate-4.9.0/_layouts/default.html --- old/geoipupdate-4.8.0/_layouts/default.html 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/_layouts/default.html 1970-01-01 01:00:00.000000000 +0100 @@ -1,54 +0,0 @@ -<!DOCTYPE html> - -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta name="description" content=""> - <meta name="author" content="MaxMind, Inc."> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <link href="https://static-gh.maxmind.com/maxmind.css" rel="stylesheet"> - <link href="//dev.maxmind.com/css/dev.maxmind.com.css" rel="stylesheet"> - <link href="//dev.maxmind.com/css/highlight-github.css" rel="stylesheet" > - <link rel="shortcut icon" href="//dev.maxmind.com/static/favicon.ico"> - <script src="//dev.maxmind.com/js/highlight.pack.js"></script> - <script>hljs.initHighlightingOnLoad();</script> - <script type="text/javascript"> - - var _gaq = _gaq || []; - _gaq.push(['_setAccount', 'UA-171943-3']); - _gaq.push(['_trackPageview']); - - (function() { - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); - })(); - - </script> - <title>{{ page.title }}</title> -</head> -<body> - -<div class="container"> - <div class="row-fluid"> - <div class="span7"> - - <ul class="nav nav-tabs"> - {% for node in site.pages %} - {% if page.url == node.url %} - <li class="active"><a href="/geoipupdate2{{node.url}}" class="active">{{node.title}}</a></li> - {% else %} - <li><a href="/geoipupdate2{{node.url}}">{{node.title}}</a></li> - {% endif %} - {% endfor %} - </ul> - - </div> - </div> - - - {{ content }} -</div> - -</body> -</html> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/cmd/geoipupdate/args.go new/geoipupdate-4.9.0/cmd/geoipupdate/args.go --- old/geoipupdate-4.8.0/cmd/geoipupdate/args.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/cmd/geoipupdate/args.go 2022-02-15 23:25:37.000000000 +0100 @@ -40,6 +40,7 @@ } if *displayVersion { log.Printf("geoipupdate %s", version) + //nolint: revive // deep exit from main package os.Exit(0) } @@ -59,5 +60,6 @@ func printUsage() { log.Printf("Usage: %s <arguments>\n", os.Args[0]) flag.PrintDefaults() + //nolint: revive // deep exit from main package os.Exit(1) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/cmd/geoipupdate/end_to_end_test.go new/geoipupdate-4.9.0/cmd/geoipupdate/end_to_end_test.go --- old/geoipupdate-4.8.0/cmd/geoipupdate/end_to_end_test.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/cmd/geoipupdate/end_to_end_test.go 2022-02-15 23:25:37.000000000 +0100 @@ -94,7 +94,7 @@ for _, editionID := range config.EditionIDs { path := filepath.Join(config.DatabaseDirectory, editionID+".mmdb") - buf, err := ioutil.ReadFile(path) //nolint:gosec + buf, err := ioutil.ReadFile(filepath.Clean(path)) require.NoError(t, err, "read file") assert.Equal( t, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/cmd/geoipupdate/version.go new/geoipupdate-4.9.0/cmd/geoipupdate/version.go --- old/geoipupdate-4.8.0/cmd/geoipupdate/version.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/cmd/geoipupdate/version.go 2022-02-15 23:25:37.000000000 +0100 @@ -1,3 +1,4 @@ +//go:build go1.12 // +build go1.12 package main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/conf/GeoIP.conf.default new/geoipupdate-4.9.0/conf/GeoIP.conf.default --- old/geoipupdate-4.8.0/conf/GeoIP.conf.default 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/conf/GeoIP.conf.default 2022-02-15 23:25:37.000000000 +0100 @@ -1,6 +1,6 @@ -# Please see https://dev.maxmind.com/geoip/geoipupdate/ for instructions -# on setting up geoipupdate, including information on how to download a -# pre-filled GeoIP.conf file. +# Please see https://dev.maxmind.com/geoip/updating-databases?lang=en for +# instructions on setting up geoipupdate, including information on how to +# download a pre-filled GeoIP.conf file. # Replace YOUR_ACCOUNT_ID_HERE and YOUR_LICENSE_KEY_HERE with an active account # ID and license key combination associated with your MaxMind account. These diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/dev-bin/release.sh new/geoipupdate-4.9.0/dev-bin/release.sh --- old/geoipupdate-4.8.0/dev-bin/release.sh 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/dev-bin/release.sh 2022-02-15 23:25:37.000000000 +0100 @@ -37,10 +37,11 @@ tag="v$version" +perl -pi -e "s/(?<=Version = \").+?(?=\")/$version/g" pkg/geoipupdate/version.go + echo $'\nRelease notes:' echo "$notes" - read -p "Continue? (y/n) " ok if [ "$ok" != "y" ]; then @@ -48,6 +49,10 @@ exit 1 fi +git commit -m "Update for $tag" -a + +git push + echo "Creating tag $tag" message="$version @@ -64,24 +69,3 @@ rm -rf dist goreleaser release --rm-dist -f .goreleaser.yml --release-notes <(echo "$message") make clean BUILDDIR=. - -rm -rf dist -goreleaser release --rm-dist -f .goreleaser-windows.yml --skip-publish -hub release edit -m "$message" \ - -a "dist/geoipupdate_${version}_windows_386.zip" \ - -a "dist/geoipupdate_${version}_windows_amd64.zip" \ - -a dist/checksums-windows.txt \ - "$tag" -make clean BUILDDIR=. - -rm -rf dist -goreleaser release --rm-dist -f .goreleaser-packages.yml --skip-publish - -hub release edit -m "$message" \ - -a dist/checksums-dpkg-rpm.txt \ - -a "dist/geoipupdate_${version}_linux_386.deb" \ - -a "dist/geoipupdate_${version}_linux_amd64.deb" \ - -a "dist/geoipupdate_${version}_linux_386.rpm" \ - -a "dist/geoipupdate_${version}_linux_amd64.rpm" \ - "$tag" -make clean BUILDDIR=. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/doc/geoipupdate.md new/geoipupdate-4.9.0/doc/geoipupdate.md --- old/geoipupdate-4.8.0/doc/geoipupdate.md 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/doc/geoipupdate.md 2022-02-15 23:25:37.000000000 +0100 @@ -76,7 +76,7 @@ Written by William Storey. -This software is Copyright (c) 2018-2020 by MaxMind, Inc. +This software is Copyright (c) 2018-2022 by MaxMind, Inc. This is free software, licensed under the Apache License, Version 2.0 or the MIT License, at your option. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/go.mod new/geoipupdate-4.9.0/go.mod --- old/geoipupdate-4.8.0/go.mod 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/go.mod 2022-02-15 23:25:37.000000000 +0100 @@ -10,7 +10,7 @@ github.com/pkg/errors v0.9.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.7.0 - golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1 // indirect + golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/go.sum new/geoipupdate-4.9.0/go.sum --- old/geoipupdate-4.8.0/go.sum 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/go.sum 2022-02-15 23:25:37.000000000 +0100 @@ -21,6 +21,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1 h1:/DtoiOYKoQCcIFXQjz07RnWNPRCbqmSXSpgEzhC9ZHM= golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/pkg/geoipupdate/config.go new/geoipupdate-4.9.0/pkg/geoipupdate/config.go --- old/geoipupdate-4.8.0/pkg/geoipupdate/config.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/pkg/geoipupdate/config.go 2022-02-15 23:25:37.000000000 +0100 @@ -2,7 +2,6 @@ import ( "bufio" - "log" "net/url" "os" "path/filepath" @@ -29,7 +28,7 @@ } // NewConfig parses the configuration file. -func NewConfig( // nolint: gocyclo +func NewConfig( //nolint: gocyclo // long but breaking it up may be worse file, defaultDatabaseDirectory, databaseDirectory string, @@ -39,11 +38,9 @@ if err != nil { return nil, errors.Wrap(err, "error opening file") } - defer func() { - if err := fh.Close(); err != nil { - log.Fatalf("Error closing config file: %+v", errors.Wrap(err, "closing file")) - } - }() + + //nolint: gosec // We don't particularly care if the close fails + defer fh.Close() config := &Config{} scanner := bufio.NewScanner(fh) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/pkg/geoipupdate/config_test.go new/geoipupdate-4.9.0/pkg/geoipupdate/config_test.go --- old/geoipupdate-4.8.0/pkg/geoipupdate/config_test.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/pkg/geoipupdate/config_test.go 2022-02-15 23:25:37.000000000 +0100 @@ -22,7 +22,7 @@ }{ { Description: "Default config", - Input: `# Please see https://dev.maxmind.com/geoip/geoipupdate/ for instructions + Input: `# Please see https://dev.maxmind.com/geoip/updating-databases?lang=en for instructions # on setting up geoipupdate, including information on how to download a # pre-filled GeoIP.conf file. @@ -81,7 +81,7 @@ }, { Description: "Default config, old names", - Input: `# Please see https://dev.maxmind.com/geoip/geoipupdate/ for instructions + Input: `# Please see https://dev.maxmind.com/geoip/updating-databases?lang=en for instructions # on setting up geoipupdate, including information on how to download a # pre-filled GeoIP.conf file. @@ -133,7 +133,7 @@ }, { Description: "Everything populated", - Input: `# Please see https://dev.maxmind.com/geoip/geoipupdate/ for instructions + Input: `# Please see https://dev.maxmind.com/geoip/updating-databases?lang=en for instructions # on setting up geoipupdate, including information on how to download a # pre-filled GeoIP.conf file. @@ -328,7 +328,7 @@ { Description: "CR line ending does not work", Input: "AccountID 0\rLicenseKey 123\rEditionIDs GeoIP2-City\r", - // nolint: lll + //nolint: lll Err: `invalid account ID format: strconv.Atoi: parsing "0 LicenseKey 123 EditionIDs GeoIP2-City": invalid syntax`, }, { @@ -373,7 +373,7 @@ for _, test := range tests { t.Run(test.Description, func(t *testing.T) { - require.NoError(t, ioutil.WriteFile(tempName, []byte(test.Input), 0600)) + require.NoError(t, ioutil.WriteFile(tempName, []byte(test.Input), 0o600)) config, err := NewConfig(tempName, DefaultDatabaseDirectory, "/tmp", false) if test.Err == "" { assert.NoError(t, err, test.Description) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/pkg/geoipupdate/database/http_reader.go new/geoipupdate-4.9.0/pkg/geoipupdate/database/http_reader.go --- old/geoipupdate-4.8.0/pkg/geoipupdate/database/http_reader.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/pkg/geoipupdate/database/http_reader.go 2022-02-15 23:25:37.000000000 +0100 @@ -144,22 +144,20 @@ } // Perform the download. - - req, err := http.NewRequest(http.MethodGet, updateURL, nil) // nolint: noctx + //nolint: noctx // using the context would require an API change + req, err := http.NewRequest(http.MethodGet, updateURL, nil) if err != nil { return "", time.Time{}, false, errors.Wrap(err, "error creating request") } + req.Header.Add("User-Agent", "geoipupdate/"+geoipupdate.Version) req.SetBasicAuth(fmt.Sprintf("%d", reader.accountID), reader.licenseKey) response, err := reader.client.Do(req) if err != nil { return "", time.Time{}, false, errors.Wrap(err, "error performing HTTP request") } - defer func() { - if err := response.Body.Close(); err != nil { - log.Fatalf("Error closing response body: %+v", errors.Wrap(err, "closing body")) - } - }() + + defer response.Body.Close() if response.StatusCode == http.StatusNotModified { if reader.verbose { @@ -193,7 +191,8 @@ } }() - if _, err := io.Copy(tempFile, gzReader); err != nil { //nolint:gosec + //nolint:gosec // A decompression bomb is unlikely here + if _, err := io.Copy(tempFile, gzReader); err != nil { return "", time.Time{}, false, errors.Wrap(err, "error writing response") } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/pkg/geoipupdate/database/http_reader_test.go new/geoipupdate-4.9.0/pkg/geoipupdate/database/http_reader_test.go --- old/geoipupdate-4.8.0/pkg/geoipupdate/database/http_reader_test.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/pkg/geoipupdate/database/http_reader_test.go 2022-02-15 23:25:37.000000000 +0100 @@ -97,7 +97,7 @@ DownloadHeaders: map[string]string{ "X-Database-MD5": "5d41402abc4b2a76b9719d911017c592", // "hello" }, - // nolint: lll + //nolint: lll Err: `md5 of new database \(985ecf3d7959b146208b3dc0189b21a5\) does not match expected md5 \(5d41402abc4b2a76b9719d911017c592\)`, }, { @@ -192,7 +192,8 @@ } if test.CreateDirectory { - err := os.Mkdir(config.DatabaseDirectory, 0755) //nolint:gosec + //nolint:gosec // seems ok in test + err := os.Mkdir(config.DatabaseDirectory, 0o755) require.NoError(t, err) } @@ -204,7 +205,7 @@ err := ioutil.WriteFile( currentDatabasePath, []byte(test.DatabaseBefore), - 0600, + 0o600, ) require.NoError(t, err) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/pkg/geoipupdate/database/local_file_writer.go new/geoipupdate-4.9.0/pkg/geoipupdate/database/local_file_writer.go --- old/geoipupdate-4.8.0/pkg/geoipupdate/database/local_file_writer.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/pkg/geoipupdate/database/local_file_writer.go 2022-02-15 23:25:37.000000000 +0100 @@ -47,10 +47,11 @@ } temporaryFilename := fmt.Sprintf("%s.temporary", dbWriter.filePath) - dbWriter.temporaryFile, err = os.OpenFile( //nolint:gosec + //nolint:gosec // We want the permission to be world readable + dbWriter.temporaryFile, err = os.OpenFile( temporaryFilename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, - 0644, + 0o644, ) if err != nil { return nil, errors.Wrap(err, "error creating temporary file") @@ -90,7 +91,11 @@ // Write writes to the temporary file. func (writer *LocalFileDatabaseWriter) Write(p []byte) (int, error) { - return writer.fileWriter.Write(p) + n, err := writer.fileWriter.Write(p) + if err != nil { + return 0, errors.Wrap(err, "error writing") + } + return n, nil } // Close closes the temporary file and releases the file lock. @@ -148,15 +153,14 @@ if err != nil { return errors.Wrap(err, "error opening database directory") } - defer func() { - if err := dh.Close(); err != nil { - log.Fatalf("Error closing directory: %+v", errors.Wrap(err, "closing directory")) - } - }() // We ignore Sync errors as they primarily happen on file systems that do // not support sync. _ = dh.Sync() + + if err := dh.Close(); err != nil { + return errors.Wrap(err, "closing directory") + } return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/pkg/geoipupdate/defaults_notwin.go new/geoipupdate-4.9.0/pkg/geoipupdate/defaults_notwin.go --- old/geoipupdate-4.8.0/pkg/geoipupdate/defaults_notwin.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/pkg/geoipupdate/defaults_notwin.go 2022-02-15 23:25:37.000000000 +0100 @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package geoipupdate @@ -5,8 +6,11 @@ var ( // These match what you'd get building the C geoipupdate from source. - // DefaultConfigFile is the default location that GeoipUpdate will look for the *.conf file + // DefaultConfigFile is the default location that GeoipUpdate will look for + // the *.conf file. DefaultConfigFile = "/usr/local/etc/GeoIP.conf" - // DefaultDatabaseDirectory is the default directory that will be used for saving to the local file system + + // DefaultDatabaseDirectory is the default directory that will be used for + // saving to the local file system. DefaultDatabaseDirectory = "/usr/local/share/GeoIP" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/pkg/geoipupdate/geoip_updater.go new/geoipupdate-4.9.0/pkg/geoipupdate/geoip_updater.go --- old/geoipupdate-4.8.0/pkg/geoipupdate/geoip_updater.go 2021-06-28 16:11:50.000000000 +0200 +++ new/geoipupdate-4.9.0/pkg/geoipupdate/geoip_updater.go 2022-02-15 23:25:37.000000000 +0100 @@ -46,26 +46,28 @@ log.Printf("Performing get filename request to %s", maxMindURL) } - req, err := http.NewRequest(http.MethodGet, maxMindURL, nil) // nolint: noctx + //nolint: noctx // as it would require a breaking API change + req, err := http.NewRequest(http.MethodGet, maxMindURL, nil) if err != nil { return errors.Wrap(err, "error creating HTTP request") } + req.Header.Add("User-Agent", "geoipupdate/"+Version) res, err := client.Do(req) if err != nil { return errors.Wrap(err, "error performing HTTP request") } - defer func() { - if err := res.Body.Close(); err != nil { - log.Fatalf("error closing response body: %+v", errors.Wrap(err, "closing body")) - } - }() buf, err = ioutil.ReadAll(io.LimitReader(res.Body, 256)) if err != nil { + _ = res.Body.Close() return errors.Wrap(err, "error reading response body") } + if err := res.Body.Close(); err != nil { + return errors.Wrap(err, "closing body") + } + if res.StatusCode != http.StatusOK { err := internal.HTTPError{ Body: string(buf), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geoipupdate-4.8.0/pkg/geoipupdate/version.go new/geoipupdate-4.9.0/pkg/geoipupdate/version.go --- old/geoipupdate-4.8.0/pkg/geoipupdate/version.go 1970-01-01 01:00:00.000000000 +0100 +++ new/geoipupdate-4.9.0/pkg/geoipupdate/version.go 2022-02-15 23:25:37.000000000 +0100 @@ -0,0 +1,4 @@ +package geoipupdate + +// Version defines current geoipupdate version. +const Version = "4.8.0" ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/geoipupdate/vendor.tar.gz /work/SRC/openSUSE:Factory/.geoipupdate.new.1958/vendor.tar.gz differ: char 139, line 1