Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package editorconfig-checker for
openSUSE:Factory checked in at 2025-03-17 22:17:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/editorconfig-checker (Old)
and /work/SRC/openSUSE:Factory/.editorconfig-checker.new.19136 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "editorconfig-checker"
Mon Mar 17 22:17:06 2025 rev:5 rq:1253497 version:3.2.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/editorconfig-checker/editorconfig-checker.changes
2025-01-29 16:11:32.490359567 +0100
+++
/work/SRC/openSUSE:Factory/.editorconfig-checker.new.19136/editorconfig-checker.changes
2025-03-17 22:21:11.383493198 +0100
@@ -1,0 +2,30 @@
+Sun Mar 16 12:35:44 UTC 2025 - [email protected]
+
+- Update to version 3.2.1:
+ * chore(main): release 3.2.1 (#450)
+ * fix: empty format in the config file should be treated as
+ Default (#448)
+ * ci: extend the CI to MacOS to catch regressions (#440)
+ * chore(deps): bump golang.org/x/net from 0.33.0 to 0.36.0 (#453)
+ * chore(deps): bump github.com/gkampitakis/go-snaps from 0.5.9 to
+ 0.5.11 (#443)
+ * chore(deps): bump
+ github.com/editorconfig/editorconfig-core-go/v2 (#452)
+ * fix(test): support running our test suite under `-trimpath`,
+ closes #397 (#439)
+ * fix(test): make TestGetRelativePath work under Darwin (#445)
+ * chore(deps): bump golang.org/x/text from 0.22.0 to 0.23.0
+ (#449)
+ * fix(test): we no longer need -ldflags at all (#444)
+ * fix: check for exclusion before MIME type (#447)
+ * ci: use new goreleaser formats to get the archives we need
+ (#425)
+ * build: switch to go1.24 (#446)
+ * chore: make sure we always use our latest release in pre-commit
+ (#436)
+ * chore(deps): bump golang.org/x/text from 0.21.0 to 0.22.0
+ (#438)
+ * chore(deps): bump github.com/gkampitakis/go-snaps from 0.5.8 to
+ 0.5.9 (#435)
+
+-------------------------------------------------------------------
Old:
----
editorconfig-checker-3.2.0.obscpio
New:
----
editorconfig-checker-3.2.1.obscpio
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ editorconfig-checker.spec ++++++
--- /var/tmp/diff_new_pack.G8VuaL/_old 2025-03-17 22:21:11.919515588 +0100
+++ /var/tmp/diff_new_pack.G8VuaL/_new 2025-03-17 22:21:11.919515588 +0100
@@ -19,7 +19,7 @@
%define executable_name ec
Name: editorconfig-checker
-Version: 3.2.0
+Version: 3.2.1
Release: 0
Summary: Tool to verify that your files are in harmony with your
.editorconfig
License: MIT
++++++ _service ++++++
--- /var/tmp/diff_new_pack.G8VuaL/_old 2025-03-17 22:21:11.959517259 +0100
+++ /var/tmp/diff_new_pack.G8VuaL/_new 2025-03-17 22:21:11.963517426 +0100
@@ -3,7 +3,7 @@
<param
name="url">https://github.com/editorconfig-checker/editorconfig-checker</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
- <param name="revision">v3.2.0</param>
+ <param name="revision">v3.2.1</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="changesgenerate">enable</param>
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.G8VuaL/_old 2025-03-17 22:21:11.983518261 +0100
+++ /var/tmp/diff_new_pack.G8VuaL/_new 2025-03-17 22:21:11.987518428 +0100
@@ -1,6 +1,6 @@
<servicedata>
<service name="tar_scm">
<param
name="url">https://github.com/editorconfig-checker/editorconfig-checker</param>
- <param
name="changesrevision">3bf69e34d0c84ad7c3ba9e490c4b150139a28f55</param></service></servicedata>
+ <param
name="changesrevision">6a81239415a6d3a4e41a753d2f30b5db73db32d9</param></service></servicedata>
(No newline at EOF)
++++++ editorconfig-checker-3.2.0.obscpio -> editorconfig-checker-3.2.1.obscpio
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/.github/workflows/ci.yml
new/editorconfig-checker-3.2.1/.github/workflows/ci.yml
--- old/editorconfig-checker-3.2.0/.github/workflows/ci.yml 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/.github/workflows/ci.yml 2025-03-15
21:30:51.000000000 +0100
@@ -8,6 +8,7 @@
jobs:
ci:
+ name: CI on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -25,3 +26,15 @@
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
+
+ ci-macos:
+ name: CI on MacOS
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-go@v5
+ with:
+ go-version-file: "go.mod"
+ - run: make test
+ - run: make run
+ - run: make bench
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/.goreleaser.yaml
new/editorconfig-checker-3.2.1/.goreleaser.yaml
--- old/editorconfig-checker-3.2.0/.goreleaser.yaml 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/.goreleaser.yaml 2025-03-15
21:30:51.000000000 +0100
@@ -64,26 +64,28 @@
- id: archive-editorconfig-checker
builds:
- editorconfig-checker
- format: tar.gz
+ formats:
+ - tar.gz
name_template: >-
{{ .ProjectName }}-{{- .Os }}-{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end
}}
format_overrides:
- goos: windows
- format: zip
+ formats:
+ - tar.gz
+ - zip
- id: archive-ec
builds:
- ec-compat
- format: tar.gz
- name_template: >-
- ec-{{- .Os }}-{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end }}
-
- - id: archive-ec-zip
- builds:
- - ec-compat
- format: zip
+ formats:
+ - tar.gz
name_template: >-
ec-{{- .Os }}-{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end }}
+ format_overrides:
+ - goos: windows
+ formats:
+ - tar.gz
+ - zip
nfpms:
- vendor: Editorconfig-Checker
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/.pre-commit-config.yaml
new/editorconfig-checker-3.2.1/.pre-commit-config.yaml
--- old/editorconfig-checker-3.2.0/.pre-commit-config.yaml 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/.pre-commit-config.yaml 2025-03-15
21:30:51.000000000 +0100
@@ -13,8 +13,8 @@
hooks:
- id: validate_manifest
- repo: https://github.com/editorconfig-checker/editorconfig-checker
- # after next release: replace with the newly created tag
- rev: 10f16fc843581773830f0cbf3a3f8c285ee1edc3
+ # this git tag name is kept in sync by release-please
+ rev: v3.2.0
hooks:
- id: editorconfig-checker
stages:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/editorconfig-checker-3.2.0/.release-please-manifest.json
new/editorconfig-checker-3.2.1/.release-please-manifest.json
--- old/editorconfig-checker-3.2.0/.release-please-manifest.json
2025-01-27 20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/.release-please-manifest.json
2025-03-15 21:30:51.000000000 +0100
@@ -1,3 +1,3 @@
{
- ".": "3.2.0"
+ ".": "3.2.1"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/CHANGELOG.md
new/editorconfig-checker-3.2.1/CHANGELOG.md
--- old/editorconfig-checker-3.2.0/CHANGELOG.md 2025-01-27 20:26:09.000000000
+0100
+++ new/editorconfig-checker-3.2.1/CHANGELOG.md 2025-03-15 21:30:51.000000000
+0100
@@ -1,5 +1,16 @@
# Changelog
+##
[3.2.1](https://github.com/editorconfig-checker/editorconfig-checker/compare/v3.2.0...v3.2.1)
(2025-03-15)
+
+
+### Bug Fixes
+
+* check for exclusion before MIME type
([#447](https://github.com/editorconfig-checker/editorconfig-checker/issues/447))
([cd9976b](https://github.com/editorconfig-checker/editorconfig-checker/commit/cd9976ba25738a02a2130a7fc5e729ed9d6b7251))
+* empty format in the config file should be treated as Default
([#448](https://github.com/editorconfig-checker/editorconfig-checker/issues/448))
([f8799d0](https://github.com/editorconfig-checker/editorconfig-checker/commit/f8799d0915e6c7a3c82941c14b5bafcf472283cf)),
closes
[#430](https://github.com/editorconfig-checker/editorconfig-checker/issues/430)
+* **test:** make TestGetRelativePath work under Darwin
([#445](https://github.com/editorconfig-checker/editorconfig-checker/issues/445))
([d956561](https://github.com/editorconfig-checker/editorconfig-checker/commit/d95656138c991c47847015902c75f46aeccb8d06))
+* **test:** support running our test suite under `-trimpath`, closes
[#397](https://github.com/editorconfig-checker/editorconfig-checker/issues/397)
([#439](https://github.com/editorconfig-checker/editorconfig-checker/issues/439))
([fc78406](https://github.com/editorconfig-checker/editorconfig-checker/commit/fc78406ae4d64dc63256c5b37db61b770bf5e436))
+* **test:** we no longer need -ldflags at all
([#444](https://github.com/editorconfig-checker/editorconfig-checker/issues/444))
([9ffcae2](https://github.com/editorconfig-checker/editorconfig-checker/commit/9ffcae2b7d984c6bf48fde83aaf55ab8962a927a))
+
##
[3.2.0](https://github.com/editorconfig-checker/editorconfig-checker/compare/v3.1.2...v3.2.0)
(2025-01-25)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/Makefile
new/editorconfig-checker-3.2.1/Makefile
--- old/editorconfig-checker-3.2.0/Makefile 2025-01-27 20:26:09.000000000
+0100
+++ new/editorconfig-checker-3.2.1/Makefile 2025-03-15 21:30:51.000000000
+0100
@@ -39,8 +39,9 @@
rm -f $(DESTDIR)$(prefix)$(mandir)/man1/editorconfig-checker.1
test: ## Run test suite
- @go test -ldflags -race -coverprofile=coverage.txt -covermode=atomic
./...
- @go vet ./...
+ go test -race -coverprofile=coverage.txt -covermode=atomic ./...
+ go test -trimpath -race -coverprofile=coverage.txt -covermode=atomic
./...
+ go vet ./...
@test -z $(shell gofmt -s -l . | tee $(STDERR)) || (echo "[ERROR] Fix
formatting issues with 'gofmt'" && exit 1)
bench: ## Run benchmark
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/README.md
new/editorconfig-checker-3.2.1/README.md
--- old/editorconfig-checker-3.2.0/README.md 2025-01-27 20:26:09.000000000
+0100
+++ new/editorconfig-checker-3.2.1/README.md 2025-03-15 21:30:51.000000000
+0100
@@ -57,7 +57,7 @@
<!-- x-release-please-start-version -->
```shell
-VERSION="v3.2.0"
+VERSION="v3.2.1"
OS="linux"
ARCH="amd64"
curl -O -L -C -
https://github.com/editorconfig-checker/editorconfig-checker/releases/download/$VERSION/ec-$OS-$ARCH.tar.gz
&& \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/editorconfig-checker-3.2.0/cmd/editorconfig-checker/main.go
new/editorconfig-checker-3.2.1/cmd/editorconfig-checker/main.go
--- old/editorconfig-checker-3.2.0/cmd/editorconfig-checker/main.go
2025-01-27 20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/cmd/editorconfig-checker/main.go
2025-03-15 21:30:51.000000000 +0100
@@ -4,7 +4,6 @@
import (
"errors"
"flag"
- "fmt"
"io/fs"
"os"
"strconv"
@@ -22,7 +21,7 @@
// version is used for the help and to verify against the version stored in
the config file
// version is dynamically set at compiletime
-var version string = "v3.2.0" // x-release-please-version
+var version string = "v3.2.1" // x-release-please-version
// defaultConfigFileNames determines the file names where the config is located
var defaultConfigFileNames = []string{".editorconfig-checker.json", ".ecrc"}
@@ -121,7 +120,7 @@
if writeConfigFile {
err := currentConfig.Save(version)
if err != nil {
- currentConfig.Logger.Error(err.Error())
+ currentConfig.Logger.Error("%v", err.Error())
exitProxy(exitCodeErrorOccurred)
}
@@ -132,7 +131,7 @@
// this error should be surpressed if the configFilePath was not set by
the user
// since the default config paths could trigger this
if err != nil && !(configFilePath == "" && errors.Is(err,
fs.ErrNotExist)) {
- currentConfig.Logger.Error(err.Error())
+ currentConfig.Logger.Error("%v", err.Error())
exitProxy(exitCodeConfigFileNotFound)
}
@@ -162,7 +161,7 @@
if utils.FileExists(config.Path) && config.Version != "" &&
config.Version != version {
config.Logger.Error("Version from config file is not the same
as the version of the binary")
- config.Logger.Error(fmt.Sprintf("Binary: %s, Config %s",
version, config.Version))
+ config.Logger.Error("Binary: %s, Config %s", version,
config.Version)
exitProxy(exitCodeErrorOccurred)
}
@@ -176,13 +175,13 @@
filePaths, err := files.GetFiles(config)
if err != nil {
- config.Logger.Error(err.Error())
+ config.Logger.Error("%v", err.Error())
exitProxy(exitCodeErrorOccurred)
}
if config.DryRun {
for _, file := range filePaths {
- config.Logger.Output(file)
+ config.Logger.Output("%s", file)
}
exitProxy(exitCodeNormal)
@@ -205,7 +204,7 @@
func ReturnableFlags(config config.Config) bool {
switch {
case config.ShowVersion:
- config.Logger.Output(version)
+ config.Logger.Output("%s", version)
case config.Help:
config.Logger.Output("USAGE:")
flag.CommandLine.SetOutput(config.Logger.GetWriter())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/editorconfig-checker-3.2.0/cmd/editorconfig-checker/main_test.go
new/editorconfig-checker-3.2.1/cmd/editorconfig-checker/main_test.go
--- old/editorconfig-checker-3.2.0/cmd/editorconfig-checker/main_test.go
2025-01-27 20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/cmd/editorconfig-checker/main_test.go
2025-03-15 21:30:51.000000000 +0100
@@ -185,20 +185,9 @@
// a little Helper to set the current working dir relative to the repository
root,
// and return to the previous working directory once the test completes
func cdRelativeToRepo(t *testing.T, path string) {
+ t.Helper()
newdir := "../../" + path
-
- startingDir, err := os.Getwd()
- if err != nil {
- t.Fatalf("Could not obtain current working directory: %s", err)
- }
- t.Cleanup(func() {
- if err := os.Chdir(startingDir); err != nil {
- t.Fatalf("Could not restore old working directory %s:
%s", startingDir, err)
- }
- })
- if err := os.Chdir(newdir); err != nil {
- t.Fatalf("Could not chdir to %s: %s", newdir, err)
- }
+ t.Chdir(newdir)
}
func TestReturnCodeInterface(t *testing.T) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/default.nix
new/editorconfig-checker-3.2.1/default.nix
--- old/editorconfig-checker-3.2.0/default.nix 2025-01-27 20:26:09.000000000
+0100
+++ new/editorconfig-checker-3.2.1/default.nix 2025-03-15 21:30:51.000000000
+0100
@@ -2,7 +2,7 @@
with pkgs;
buildGoPackage rec {
- version = "v3.2.0" # x-release-please-version
+ version = "v3.2.1" # x-release-please-version
# create link so the tool can also be executed as `ec`
postInstall = ''
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/go.mod
new/editorconfig-checker-3.2.1/go.mod
--- old/editorconfig-checker-3.2.0/go.mod 2025-01-27 20:26:09.000000000
+0100
+++ new/editorconfig-checker-3.2.1/go.mod 2025-03-15 21:30:51.000000000
+0100
@@ -1,14 +1,14 @@
module github.com/editorconfig-checker/editorconfig-checker/v3 //
x-release-please-major
-go 1.23
+go 1.24
-toolchain go1.23.4
+toolchain go1.24.0
require (
github.com/baulk/chardet v0.1.0
- github.com/editorconfig/editorconfig-core-go/v2 v2.6.2
+ github.com/editorconfig/editorconfig-core-go/v2 v2.6.3
github.com/gabriel-vasile/mimetype v1.4.8
- golang.org/x/text v0.21.0
+ golang.org/x/text v0.23.0
)
require (
@@ -27,10 +27,10 @@
require (
github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/gkampitakis/go-snaps v0.5.8
+ github.com/gkampitakis/go-snaps v0.5.11
github.com/pmezard/go-difflib v1.0.0 // indirect
- golang.org/x/mod v0.18.0 // indirect
- golang.org/x/net v0.33.0 // indirect
+ golang.org/x/mod v0.23.0 // indirect
+ golang.org/x/net v0.36.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/go.sum
new/editorconfig-checker-3.2.1/go.sum
--- old/editorconfig-checker-3.2.0/go.sum 2025-01-27 20:26:09.000000000
+0100
+++ new/editorconfig-checker-3.2.1/go.sum 2025-03-15 21:30:51.000000000
+0100
@@ -3,20 +3,20 @@
github.com/creack/pty v1.1.9/go.mod
h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
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=
-github.com/editorconfig/editorconfig-core-go/v2 v2.6.2
h1:dKG8sc7n321deIVRcQtwlMNoBEra7j0qQ8RwxO8RN0w=
-github.com/editorconfig/editorconfig-core-go/v2 v2.6.2/go.mod
h1:7dvD3GCm7eBw53xZ/lsiq72LqobdMg3ITbMBxnmJmqY=
+github.com/editorconfig/editorconfig-core-go/v2 v2.6.3
h1:XVUp6qW3BIkmM3/1EkrHpa6bL56APOynfXcZEmIgOhs=
+github.com/editorconfig/editorconfig-core-go/v2 v2.6.3/go.mod
h1:ThHVc+hqbUsmE1wmK/MASpQEhCleWu1JDJDNhUOMy0c=
github.com/gabriel-vasile/mimetype v1.4.8
h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
github.com/gabriel-vasile/mimetype v1.4.8/go.mod
h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
github.com/gkampitakis/ciinfo v0.3.1
h1:lzjbemlGI4Q+XimPg64ss89x8Mf3xihJqy/0Mgagapo=
github.com/gkampitakis/ciinfo v0.3.1/go.mod
h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo=
github.com/gkampitakis/go-diff v1.3.2
h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M=
github.com/gkampitakis/go-diff v1.3.2/go.mod
h1:LLgOrpqleQe26cte8s36HTWcTmMEur6OPYerdAAS9tk=
-github.com/gkampitakis/go-snaps v0.5.8
h1:BB4ihcyXgJEVO/Pj/P+4bs7pFzsLcEjsfU2+mFdJh1c=
-github.com/gkampitakis/go-snaps v0.5.8/go.mod
h1:PcKmy8q5Se7p48ywpogN5Td13reipz1Iivah4wrTIvY=
+github.com/gkampitakis/go-snaps v0.5.11
h1:LFG0ggUKR+KEiiaOvFCmLgJ5NO2zf93AxxddkBn3LdQ=
+github.com/gkampitakis/go-snaps v0.5.11/go.mod
h1:PcKmy8q5Se7p48ywpogN5Td13reipz1Iivah4wrTIvY=
github.com/goccy/go-yaml v1.15.13
h1:Xd87Yddmr2rC1SLLTm2MNDcTjeO/GYo0JGiww6gSTDg=
github.com/goccy/go-yaml v1.15.13/go.mod
h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
-github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
-github.com/google/go-cmp v0.6.0/go.mod
h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
+github.com/google/go-cmp v0.7.0/go.mod
h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod
h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -41,12 +41,12 @@
github.com/tidwall/pretty v1.2.1/go.mod
h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod
h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
-golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
-golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
-golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
-golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
-golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
-golang.org/x/text v0.21.0/go.mod
h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
+golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
+golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
+golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA=
+golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
+golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
+golang.org/x/text v0.23.0/go.mod
h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod
h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/pkg/config/config_test.go
new/editorconfig-checker-3.2.1/pkg/config/config_test.go
--- old/editorconfig-checker-3.2.0/pkg/config/config_test.go 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/pkg/config/config_test.go 2025-03-15
21:30:51.000000000 +0100
@@ -113,7 +113,7 @@
mergeConfig := Config{
ShowVersion: true,
- Version: "v3.2.0", // x-release-please-version
+ Version: "v3.2.1", // x-release-please-version
Help: true,
DryRun: true,
Path: "some-other",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/pkg/error/error.go
new/editorconfig-checker-3.2.1/pkg/error/error.go
--- old/editorconfig-checker-3.2.0/pkg/error/error.go 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/pkg/error/error.go 2025-03-15
21:30:51.000000000 +0100
@@ -104,7 +104,7 @@
relativeFilePath, err :=
files.GetRelativePath(fileErrors.FilePath)
if err != nil {
- config.Logger.Error(err.Error())
+ config.Logger.Error("%v", err.Error())
continue
}
@@ -139,7 +139,7 @@
relativeFilePath, err :=
files.GetRelativePath(fileErrors.FilePath)
if err != nil {
- config.Logger.Error(err.Error())
+ config.Logger.Error("%v", err.Error())
continue
}
@@ -175,7 +175,7 @@
relativeFilePath, err :=
files.GetRelativePath(fileErrors.FilePath)
if err != nil {
- config.Logger.Error(err.Error())
+ config.Logger.Error("%v", err.Error())
continue
}
@@ -204,7 +204,7 @@
relativeFilePath, err :=
files.GetRelativePath(fileErrors.FilePath)
if err != nil {
- config.Logger.Error(err.Error())
+ config.Logger.Error("%v", err.Error())
continue
}
@@ -221,7 +221,7 @@
if err != nil {
config.Logger.Error("Error creating codeclimate json:
%s", err.Error())
} else {
- config.Logger.Output(string(codeclimateIssuesJSON))
+ config.Logger.Output("%s",
string(codeclimateIssuesJSON))
}
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/pkg/error/error_test.go
new/editorconfig-checker-3.2.1/pkg/error/error_test.go
--- old/editorconfig-checker-3.2.0/pkg/error/error_test.go 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/pkg/error/error_test.go 2025-03-15
21:30:51.000000000 +0100
@@ -233,22 +233,13 @@
The relative path conversion done by FormatErrors() changes how
absolute paths
are displayed, depending on in which directory the test is run
in.
- When this codebase uses golang 1.23.X (what ever version
contains commit 79ca434)
- This entire section can be replaced with a call to t.Chdir("/")
- (the cleanup is then done automatically)
+ We however still need to keep track of where we started, else
we could to give snaps the path to the snapshots.
*/
startingDir, err := os.Getwd()
if err != nil {
t.Fatalf("Could not obtain current working directory: %s", err)
}
- t.Cleanup(func() {
- if err := os.Chdir(startingDir); err != nil {
- t.Fatalf("Could not restore old working directory %s:
%s", startingDir, err)
- }
- })
- if err := os.Chdir("/"); err != nil {
- t.Fatalf("Could not chdir to /: %s", err)
- }
+ t.Chdir("/")
/*
why care about the path separators?
@@ -268,7 +259,7 @@
t.Fatal("current path separator is unexpected - please fix test
to handle this path separator")
}
s := snaps.WithConfig(
- snaps.Dir(filepath.Join("__snapshots__",
"pathseparator-"+safePathSep)),
+ snaps.Dir(filepath.Join(startingDir, "__snapshots__",
"pathseparator-"+safePathSep)),
)
input := []ValidationErrors{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/pkg/files/files.go
new/editorconfig-checker-3.2.1/pkg/files/files.go
--- old/editorconfig-checker-3.2.0/pkg/files/files.go 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/pkg/files/files.go 2025-03-15
21:30:51.000000000 +0100
@@ -55,24 +55,28 @@
// AddToFiles adds a file to a slice if it isn't already in there
// and meets the requirements and returns the new slice
func AddToFiles(filePaths []string, filePath string, config config.Config)
[]string {
- contentType, err := GetContentType(filePath, config)
+ config.Logger.Debug("AddToFiles: investigating file %s", filePath)
- config.Logger.Debug("AddToFiles: filePath: %s, contentType: %s",
filePath, contentType)
+ isExcluded, err := IsExcluded(filePath, config)
+ if err == nil && isExcluded {
+ config.Logger.Verbose("Not adding %s to be checked, it is
excluded", filePath)
+ return filePaths
+ }
+ contentType, err := GetContentType(filePath, config)
if err != nil {
config.Logger.Error("Could not get the ContentType of file:
%s", filePath)
- config.Logger.Error(err.Error())
+ config.Logger.Error("%v", err.Error())
}
+ config.Logger.Debug("AddToFiles: detected ContentType %s on file %s",
contentType, filePath)
- isExcluded, err := IsExcluded(filePath, config)
-
- if err == nil && !isExcluded && IsAllowedContentType(contentType,
config) {
- config.Logger.Verbose("Add %s to be checked", filePath)
- return append(filePaths, filePath)
+ if err == nil && !IsAllowedContentType(contentType, config) {
+ config.Logger.Verbose("Not adding %s to be checked, it does not
have an allowed ContentType", filePath)
+ return filePaths
}
- config.Logger.Verbose("Don't add %s to be checked", filePath)
- return filePaths
+ config.Logger.Verbose("Adding %s to be checked", filePath)
+ return append(filePaths, filePath)
}
// GetFiles returns all files which should be checked
@@ -234,11 +238,15 @@
// IsAllowedContentType returns whether the contentType is
// an allowed content type to check or not
func IsAllowedContentType(contentType string, config config.Config) bool {
- result := false
-
+ /*
+ why not use mimetype.EqualsAny:
+ it would only match types exactly, but we allow our users to
give an entire type/ category
+ */
for _, allowedContentType := range config.AllowedContentTypes {
- result = result || strings.Contains(contentType,
allowedContentType)
+ if strings.Contains(contentType, allowedContentType) {
+ return true
+ }
}
- return result
+ return false
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/editorconfig-checker-3.2.0/pkg/files/files_test.go
new/editorconfig-checker-3.2.1/pkg/files/files_test.go
--- old/editorconfig-checker-3.2.0/pkg/files/files_test.go 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/pkg/files/files_test.go 2025-03-15
21:30:51.000000000 +0100
@@ -109,22 +109,28 @@
t.Skip("Windows fails if current directory is deleted")
}
- DIR := "/tmp/stuff"
+ var DIR string
+ expectedPath := "../.."
+ if runtime.GOOS == "darwin" {
+ DIR = "/private"
+ expectedPath += "/.."
+ }
+ DIR += "/tmp/stuff"
os.Remove(DIR)
err := os.Mkdir(DIR, 0755)
if err != nil {
panic(err)
}
- err = os.Chdir(DIR)
- if err != nil {
- panic(err)
- }
+ t.Chdir(DIR)
+
+ arg := "/foo" + DIR + filePath
+ expectedPath += arg
// Check with the current directory ("/tmp/stuff") in the middle of the
given file path
- relativeFilePath, _ = GetRelativePath("/foo" + DIR + filePath)
- if relativeFilePath != "../../foo"+DIR+filePath {
- t.Errorf("GetRelativePath(%s): expected: %v, got: %v",
"/foo"+DIR+filePath, "../../foo"+DIR+filePath, relativeFilePath)
+ relativeFilePath, _ = GetRelativePath(arg)
+ if relativeFilePath != expectedPath {
+ t.Errorf("GetRelativePath(%s): expected: %v, got: %v", arg,
expectedPath, relativeFilePath)
}
err = os.Remove(DIR)
@@ -132,16 +138,14 @@
panic(err)
}
+ if runtime.GOOS == "darwin" {
+ t.Skip("Darwin can obtain the current working directory even if
it is deleted")
+ }
_, err = GetRelativePath(cwd + filePath)
if err == nil {
t.Error("Expected an error for a not existing directory")
}
-
- err = os.Chdir(cwd)
- if err != nil {
- panic(err)
- }
}
func TestAddToFiles(t *testing.T) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/editorconfig-checker-3.2.0/pkg/outputformat/outputformat.go
new/editorconfig-checker-3.2.1/pkg/outputformat/outputformat.go
--- old/editorconfig-checker-3.2.0/pkg/outputformat/outputformat.go
2025-01-27 20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/pkg/outputformat/outputformat.go
2025-03-15 21:30:51.000000000 +0100
@@ -2,6 +2,7 @@
package outputformat
import (
+ "cmp"
"fmt"
"slices"
"strings"
@@ -39,7 +40,7 @@
}
func (format *OutputFormat) UnmarshalText(data []byte) error {
- *format = OutputFormat(string(data))
+ *format = OutputFormat(cmp.Or(string(data), "default"))
if !format.IsValid() {
return fmt.Errorf("%q is not a valid output format", data)
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/editorconfig-checker-3.2.0/pkg/outputformat/outputformat_test.go
new/editorconfig-checker-3.2.1/pkg/outputformat/outputformat_test.go
--- old/editorconfig-checker-3.2.0/pkg/outputformat/outputformat_test.go
2025-01-27 20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/pkg/outputformat/outputformat_test.go
2025-03-15 21:30:51.000000000 +0100
@@ -56,3 +56,14 @@
t.Error("unmarshalling did not recognize an invalid value and
unmarshalled it anyway")
}
}
+
+func TestUnmarshallingEmptyFormat(t *testing.T) {
+ var working OutputFormat
+ err := working.UnmarshalText([]byte(""))
+ if err != nil {
+ t.Errorf("unmarshalling an empty string as the default output
format failed: %v", err)
+ }
+ if working != Default {
+ t.Error("unmarshalling an empty string did not return the
default output format")
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/editorconfig-checker-3.2.0/pkg/validation/validation.go
new/editorconfig-checker-3.2.1/pkg/validation/validation.go
--- old/editorconfig-checker-3.2.0/pkg/validation/validation.go 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/pkg/validation/validation.go 2025-03-15
21:30:51.000000000 +0100
@@ -2,7 +2,6 @@
package validation
import (
- "fmt"
"os"
"regexp"
"strconv"
@@ -62,7 +61,7 @@
charset = "unknown"
}
config.Logger.Error("Could not decode the %s
encoded file: %s", charset, filePath)
- config.Logger.Error(err.Error())
+ config.Logger.Error("%v", err.Error())
}
break
}
@@ -85,7 +84,7 @@
return validationErrors
}
if warnings != nil {
- config.Logger.Warning(warnings.Error())
+ config.Logger.Warning("%v", warnings.Error())
}
fileInformation := files.FileInformation{Content: fileContent,
FilePath: filePath, Editorconfig: definition}
@@ -180,7 +179,7 @@
fileInformation.Content,
fileInformation.Editorconfig.Raw["insert_final_newline"],
fileInformation.Editorconfig.Raw["end_of_line"]);
!config.Disable.InsertFinalNewline && currentError != nil {
- config.Logger.Verbose(fmt.Sprintf("Final newline error found in
%s", fileInformation.FilePath))
+ config.Logger.Verbose("Final newline error found in %s",
fileInformation.FilePath)
return error.ValidationError{LineNumber: -1, Message:
currentError}
}
@@ -192,7 +191,7 @@
if currentError := validators.LineEnding(
fileInformation.Content,
fileInformation.Editorconfig.Raw["end_of_line"]);
!config.Disable.EndOfLine && currentError != nil {
- config.Logger.Verbose(fmt.Sprintf("Line ending error found in
%s", fileInformation.FilePath))
+ config.Logger.Verbose("Line ending error found in %s",
fileInformation.FilePath)
return error.ValidationError{LineNumber: -1, Message:
currentError}
}
@@ -212,7 +211,7 @@
fileInformation.Line,
fileInformation.Editorconfig.Raw["indent_style"],
indentSize, config); !config.Disable.Indentation &&
currentError != nil {
- config.Logger.Verbose(fmt.Sprintf("Indentation error found in
%s on line %d", fileInformation.FilePath, fileInformation.LineNumber))
+ config.Logger.Verbose("Indentation error found in %s on line
%d", fileInformation.FilePath, fileInformation.LineNumber)
return error.ValidationError{LineNumber:
fileInformation.LineNumber + 1, Message: currentError}
}
@@ -224,7 +223,7 @@
if currentError := validators.TrailingWhitespace(
fileInformation.Line,
fileInformation.Editorconfig.Raw["trim_trailing_whitespace"] ==
"true"); !config.Disable.TrimTrailingWhitespace && currentError != nil {
- config.Logger.Verbose(fmt.Sprintf("Trailing whitespace error
found in %s on line %d", fileInformation.FilePath, fileInformation.LineNumber))
+ config.Logger.Verbose("Trailing whitespace error found in %s on
line %d", fileInformation.FilePath, fileInformation.LineNumber)
return error.ValidationError{LineNumber:
fileInformation.LineNumber + 1, Message: currentError}
}
@@ -241,7 +240,7 @@
charSet := fileInformation.Editorconfig.Raw["charset"]
if currentError := validators.MaxLineLength(fileInformation.Line,
maxLineLength, charSet); !config.Disable.MaxLineLength && currentError != nil {
- config.Logger.Verbose(fmt.Sprintf("Max line length error found
in %s on %d", fileInformation.FilePath, fileInformation.LineNumber))
+ config.Logger.Verbose("Max line length error found in %s on
%d", fileInformation.FilePath, fileInformation.LineNumber)
return error.ValidationError{LineNumber:
fileInformation.LineNumber + 1, Message: currentError}
}
@@ -253,7 +252,7 @@
var validationErrors []error.ValidationErrors
for _, filePath := range files {
- config.Logger.Verbose(fmt.Sprintf("Validate %s", filePath))
+ config.Logger.Verbose("Validate %s", filePath)
validationErrors = append(validationErrors,
error.ValidationErrors{FilePath: filePath, Errors: ValidateFile(filePath,
config)})
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/editorconfig-checker-3.2.0/release-please-config.json
new/editorconfig-checker-3.2.1/release-please-config.json
--- old/editorconfig-checker-3.2.0/release-please-config.json 2025-01-27
20:26:09.000000000 +0100
+++ new/editorconfig-checker-3.2.1/release-please-config.json 2025-03-15
21:30:51.000000000 +0100
@@ -1,6 +1,13 @@
{
"$schema":
"https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"release-type": "go",
+ "extra-files": [
+ {
+ "type": "yaml",
+ "path": ".pre-commit-config.yaml",
+ "jsonpath":
"$.repos.[?(@.repo==\"https://github.com/editorconfig-checker/editorconfig-checker\")].rev"
+ }
+ ],
"packages": {
".": {
"extra-files": [
++++++ editorconfig-checker.obsinfo ++++++
--- /var/tmp/diff_new_pack.G8VuaL/_old 2025-03-17 22:21:12.247529289 +0100
+++ /var/tmp/diff_new_pack.G8VuaL/_new 2025-03-17 22:21:12.251529456 +0100
@@ -1,5 +1,5 @@
name: editorconfig-checker
-version: 3.2.0
-mtime: 1738005969
-commit: 3bf69e34d0c84ad7c3ba9e490c4b150139a28f55
+version: 3.2.1
+mtime: 1742070651
+commit: 6a81239415a6d3a4e41a753d2f30b5db73db32d9
++++++ vendor.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/editorconfig/editorconfig-core-go/v2/.golangci.yml
new/vendor/github.com/editorconfig/editorconfig-core-go/v2/.golangci.yml
--- old/vendor/github.com/editorconfig/editorconfig-core-go/v2/.golangci.yml
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/editorconfig/editorconfig-core-go/v2/.golangci.yml
2025-03-16 13:35:47.000000000 +0100
@@ -9,6 +9,8 @@
- $gostd
- "github.com/editorconfig/editorconfig-core-go/v2"
- "github.com/hashicorp/go-multierror"
+ - "golang.org/x/mod/semver"
+ - "gopkg.in/ini.v1"
deny: []
internal:
files:
@@ -29,18 +31,10 @@
linters:
enable-all: true
disable:
- - deadcode
- - exhaustivestruct
- exhaustruct
- - golint
- - gomnd
- - ifshort
- - interfacer
- - maligned
- - nosnakecase
- - scopelint
- - structcheck
+ - mnd
- tagliatelle
- - varcheck
+ - tenv
+ - typecheck
- varnamelen
fast: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/editorconfig/editorconfig-core-go/v2/.goreleaser.yml
new/vendor/github.com/editorconfig/editorconfig-core-go/v2/.goreleaser.yml
--- old/vendor/github.com/editorconfig/editorconfig-core-go/v2/.goreleaser.yml
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/editorconfig/editorconfig-core-go/v2/.goreleaser.yml
2025-03-16 13:35:47.000000000 +0100
@@ -1,3 +1,5 @@
+version: 2
+
project_name: editorconfig-core-go
before:
@@ -21,7 +23,8 @@
- editorconfig
format_overrides:
- goos: windows
- format: zip
+ formats:
+ - zip
files:
- none*
@@ -57,7 +60,7 @@
- artifacts: checksum
snapshot:
- name_template: "{{ .Tag }}-development"
+ version_template: "{{ .Tag }}-development"
changelog:
sort: asc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/editorconfig/editorconfig-core-go/v2/CHANGELOG.md
new/vendor/github.com/editorconfig/editorconfig-core-go/v2/CHANGELOG.md
--- old/vendor/github.com/editorconfig/editorconfig-core-go/v2/CHANGELOG.md
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/editorconfig/editorconfig-core-go/v2/CHANGELOG.md
2025-03-16 13:35:47.000000000 +0100
@@ -1,5 +1,11 @@
# Change log
+## v2.6.3 - 2025-03-12
+
+- Targets Go 1.22
+- Bump x/mod to 0.23
+- Bump google/go-cmp to 0.7.0
+
## v2.6.2 - 2024-04-02
- Fix paths on Windows
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/editorconfig/editorconfig-core-go/v2/Dockerfile
new/vendor/github.com/editorconfig/editorconfig-core-go/v2/Dockerfile
--- old/vendor/github.com/editorconfig/editorconfig-core-go/v2/Dockerfile
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/editorconfig/editorconfig-core-go/v2/Dockerfile
2025-03-16 13:35:47.000000000 +0100
@@ -1,4 +1,4 @@
-FROM linuxkit/ca-certificates:v0.8
+FROM alpine:3.21
COPY editorconfig /usr/local/bin/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/gkampitakis/go-snaps/snaps/matchJSON.go
new/vendor/github.com/gkampitakis/go-snaps/snaps/matchJSON.go
--- old/vendor/github.com/gkampitakis/go-snaps/snaps/matchJSON.go
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/gkampitakis/go-snaps/snaps/matchJSON.go
2025-03-16 13:35:47.000000000 +0100
@@ -13,7 +13,7 @@
)
var (
- jsonOptions = &pretty.Options{
+ defaultPrettyJSONOptions = &pretty.Options{
SortKeys: true,
Indent: " ",
}
@@ -97,10 +97,10 @@
return
}
- snapshot := takeJSONSnapshot(j)
+ snapshot := takeJSONSnapshot(c, j)
prevSnapshot, line, err := getPrevSnapshot(testID, snapPath)
if errors.Is(err, errSnapNotFound) {
- if isCI {
+ if !shouldCreate(c.update) {
handleError(t, err)
return
}
@@ -159,8 +159,8 @@
}
}
-func takeJSONSnapshot(b []byte) string {
- return strings.TrimSuffix(string(pretty.PrettyOptions(b, jsonOptions)),
"\n")
+func takeJSONSnapshot(c *Config, b []byte) string {
+ return strings.TrimSuffix(string(pretty.PrettyOptions(b,
c.json.getPrettyJSONOptions())), "\n")
}
func applyJSONMatchers(b []byte, matchers ...match.JSONMatcher) ([]byte,
[]match.MatcherError) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/gkampitakis/go-snaps/snaps/matchSnapshot.go
new/vendor/github.com/gkampitakis/go-snaps/snaps/matchSnapshot.go
--- old/vendor/github.com/gkampitakis/go-snaps/snaps/matchSnapshot.go
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/gkampitakis/go-snaps/snaps/matchSnapshot.go
2025-03-16 13:35:47.000000000 +0100
@@ -63,7 +63,7 @@
snapshot := takeSnapshot(values)
prevSnapshot, line, err := getPrevSnapshot(testID, snapPath)
if errors.Is(err, errSnapNotFound) {
- if isCI {
+ if !shouldCreate(c.update) {
handleError(t, err)
return
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/gkampitakis/go-snaps/snaps/matchStandaloneJSON.go
new/vendor/github.com/gkampitakis/go-snaps/snaps/matchStandaloneJSON.go
--- old/vendor/github.com/gkampitakis/go-snaps/snaps/matchStandaloneJSON.go
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/gkampitakis/go-snaps/snaps/matchStandaloneJSON.go
2025-03-16 13:35:47.000000000 +0100
@@ -67,10 +67,10 @@
return
}
- snapshot := takeJSONSnapshot(j)
+ snapshot := takeJSONSnapshot(c, j)
prevSnapshot, err := getPrevStandaloneSnapshot(snapPath)
if errors.Is(err, errSnapNotFound) {
- if isCI {
+ if !shouldCreate(c.update) {
handleError(t, err)
return
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/gkampitakis/go-snaps/snaps/matchStandaloneSnapshot.go
new/vendor/github.com/gkampitakis/go-snaps/snaps/matchStandaloneSnapshot.go
--- old/vendor/github.com/gkampitakis/go-snaps/snaps/matchStandaloneSnapshot.go
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/gkampitakis/go-snaps/snaps/matchStandaloneSnapshot.go
2025-03-16 13:35:47.000000000 +0100
@@ -50,7 +50,7 @@
snapshot := pretty.Sprint(input)
prevSnapshot, err := getPrevStandaloneSnapshot(snapPath)
if errors.Is(err, errSnapNotFound) {
- if isCI {
+ if !shouldCreate(c.update) {
handleError(t, err)
return
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/gkampitakis/go-snaps/snaps/matchYAML.go
new/vendor/github.com/gkampitakis/go-snaps/snaps/matchYAML.go
--- old/vendor/github.com/gkampitakis/go-snaps/snaps/matchYAML.go
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/gkampitakis/go-snaps/snaps/matchYAML.go
2025-03-16 13:35:47.000000000 +0100
@@ -95,7 +95,7 @@
snapshot := takeYAMLSnapshot(y)
prevSnapshot, line, err := getPrevSnapshot(testID, snapPath)
if errors.Is(err, errSnapNotFound) {
- if isCI {
+ if !shouldCreate(c.update) {
handleError(t, err)
return
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/gkampitakis/go-snaps/snaps/snapshot.go
new/vendor/github.com/gkampitakis/go-snaps/snaps/snapshot.go
--- old/vendor/github.com/gkampitakis/go-snaps/snaps/snapshot.go
2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/github.com/gkampitakis/go-snaps/snaps/snapshot.go
2025-03-16 13:35:47.000000000 +0100
@@ -11,6 +11,7 @@
"sync"
"github.com/gkampitakis/go-snaps/internal/colors"
+ "github.com/tidwall/pretty"
)
var (
@@ -30,6 +31,30 @@
snapsDir string
extension string
update *bool
+ json *JSONConfig
+}
+
+type JSONConfig struct {
+ // Width is a max column width for single line arrays
+ // Default: see defaultPrettyJSONOptions.Width for detail
+ Width int
+ // Indent is the nested indentation
+ // Default: see defaultPrettyJSONOptions.Indent for detail
+ Indent string
+ // SortKeys will sort the keys alphabetically
+ // Default: see defaultPrettyJSONOptions.SortKeys for detail
+ SortKeys bool
+}
+
+func (j *JSONConfig) getPrettyJSONOptions() *pretty.Options {
+ if j == nil {
+ return defaultPrettyJSONOptions
+ }
+ return &pretty.Options{
+ Width: j.Width,
+ Indent: j.Indent,
+ SortKeys: j.SortKeys,
+ }
}
// Update determines whether to update snapshots or not
@@ -75,6 +100,15 @@
}
}
+// Specify json format configuration
+//
+// default: see defaultPrettyJSONOptions for default json config
+func JSON(json JSONConfig) func(*Config) {
+ return func(c *Config) {
+ c.json = &json
+ }
+}
+
// Create snaps with configuration
//
// e.g snaps.WithConfig(snaps.Filename("my_test")).MatchSnapshot(t, "hello
world")
@@ -318,12 +352,15 @@
callerFilename := baseCaller(3)
dir := c.snapsDir
- if !filepath.IsAbs(dir) {
+ if !filepath.IsAbs(dir) && !isTrimBathBuild {
dir = filepath.Join(filepath.Dir(callerFilename), c.snapsDir)
}
snapPath := filepath.Join(dir, constructFilename(c, callerFilename,
tName, isStandalone))
- snapPathRel, _ := filepath.Rel(filepath.Dir(callerFilename), snapPath)
+ snapPathRel := snapPath
+ if !isTrimBathBuild {
+ snapPathRel, _ = filepath.Rel(filepath.Dir(callerFilename),
snapPath)
+ }
return snapPath, snapPathRel
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/vendor/github.com/gkampitakis/go-snaps/snaps/utils.go
new/vendor/github.com/gkampitakis/go-snaps/snaps/utils.go
--- old/vendor/github.com/gkampitakis/go-snaps/snaps/utils.go 2025-01-28
15:26:04.000000000 +0100
+++ new/vendor/github.com/gkampitakis/go-snaps/snaps/utils.go 2025-03-16
13:35:47.000000000 +0100
@@ -8,6 +8,8 @@
"os"
"path/filepath"
"runtime"
+ "runtime/debug"
+ "slices"
"strings"
"sync"
@@ -22,6 +24,7 @@
defaultConfig = Config{
snapsDir: "__snapshots__",
}
+ isTrimBathBuild = trimPathBuild()
)
const (
@@ -125,3 +128,39 @@
return updateVAR == "true"
}
+
+// shouldCreate determines whether snapshots should be created
+func shouldCreate(u *bool) bool {
+ if isCI {
+ return false
+ }
+
+ if u != nil {
+ return *u
+ }
+
+ return true
+}
+
+// trimPathBuild checks if the build has trimpath setting true
+func trimPathBuild() bool {
+ keys := []string{"-trimpath", "--trimpath"}
+ goFlags := strings.Split(os.Getenv("GOFLAGS"), " ")
+
+ for _, flag := range goFlags {
+ if slices.Contains(keys, flag) {
+ return true
+ }
+ }
+
+ bInfo, ok := debug.ReadBuildInfo()
+ if ok && len(bInfo.Settings) > 0 {
+ for _, info := range bInfo.Settings {
+ if slices.Contains(keys, info.Key) {
+ return info.Value == "true"
+ }
+ }
+ }
+
+ return runtime.GOROOT() == ""
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/vendor/golang.org/x/mod/LICENSE
new/vendor/golang.org/x/mod/LICENSE
--- old/vendor/golang.org/x/mod/LICENSE 2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/golang.org/x/mod/LICENSE 2025-03-16 13:35:47.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
+Copyright 2009 The Go Authors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -10,7 +10,7 @@
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
- * Neither the name of Google Inc. nor the names of its
+ * Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/vendor/modules.txt new/vendor/modules.txt
--- old/vendor/modules.txt 2025-01-28 15:26:04.000000000 +0100
+++ new/vendor/modules.txt 2025-03-16 13:35:47.000000000 +0100
@@ -3,8 +3,8 @@
github.com/baulk/chardet
# github.com/davecgh/go-spew v1.1.1
## explicit
-# github.com/editorconfig/editorconfig-core-go/v2 v2.6.2
-## explicit; go 1.20
+# github.com/editorconfig/editorconfig-core-go/v2 v2.6.3
+## explicit; go 1.22.0
github.com/editorconfig/editorconfig-core-go/v2
# github.com/gabriel-vasile/mimetype v1.4.8
## explicit; go 1.20
@@ -18,7 +18,7 @@
# github.com/gkampitakis/go-diff v1.3.2
## explicit; go 1.20
github.com/gkampitakis/go-diff/diffmatchpatch
-# github.com/gkampitakis/go-snaps v0.5.8
+# github.com/gkampitakis/go-snaps v0.5.11
## explicit; go 1.22
github.com/gkampitakis/go-snaps/internal/colors
github.com/gkampitakis/go-snaps/internal/difflib
@@ -61,15 +61,15 @@
# github.com/tidwall/sjson v1.2.5
## explicit; go 1.14
github.com/tidwall/sjson
-# golang.org/x/mod v0.18.0
-## explicit; go 1.18
+# golang.org/x/mod v0.23.0
+## explicit; go 1.22.0
golang.org/x/mod/semver
-# golang.org/x/net v0.33.0
-## explicit; go 1.18
+# golang.org/x/net v0.36.0
+## explicit; go 1.23.0
golang.org/x/net/html
golang.org/x/net/html/atom
-# golang.org/x/text v0.21.0
-## explicit; go 1.18
+# golang.org/x/text v0.23.0
+## explicit; go 1.23.0
golang.org/x/text/encoding
golang.org/x/text/encoding/charmap
golang.org/x/text/encoding/internal