[PR #203] test: skip directories ignored by the go command in TestFormatting #202

Open
opened 2026-10-13 21:04:32 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amneziawg-go/pull/203
Author: @earmark-halt
Created: 10/9/2026
Status: 🔄 Open

Base: master ← Head: fix/format-test-skip-ignored-dirs


📝 Commits (1)

  • 75f029d test: skip directories ignored by the go command in TestFormatting

📊 Changes

1 file changed (+11 additions, -1 deletions)

View changed files

📝 format_test.go (+11 -1)

📄 Description

Fixes #195.

Problem

TestFormatting walks the whole source tree and gofmt-checks every .go file in it, including directories the go command ignores: names starting with . or _, and testdata (see go help packages). Packaging tools put GOPATH inside the source tree under such a name. Void's xbps-src uses _build-<pkgname>-xbps. Once the module cache there is populated, the test checks third-party code and fails:

--- FAIL: TestFormatting
    format_test.go:45: unformatted code: _build-amneziawg-go-xbps/pkg/mod/gvisor.dev/gvisor@v0.0.0-20231202080848-1f7806d17489/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go
    ...

Fix

Skip those directories in the walk, as the go command does. The module's own code is checked exactly as before.

Testing

  • Reproduced in a golang:1.27 container with GOPATH=$PWD/_build-amneziawg-go-xbps after go mod download: 124 "unformatted code" reports, all from the module cache (gVisor, Outline SDK, x/tools, ...), and TestFormatting fails. With the fix it passes, and so does go test ./... with the in-tree GOPATH.
  • An unformatted file added under device/ is still reported.
  • Unformatted files under .gopath/ and testdata/ are skipped, like _build-*/.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amneziawg-go/pull/203 **Author:** [@earmark-halt](https://github.com/earmark-halt) **Created:** 10/9/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix/format-test-skip-ignored-dirs` --- ### 📝 Commits (1) - [`75f029d`](https://github.com/amnezia-vpn/amneziawg-go/commit/75f029d05a6fde8b403d0aebad40ca54178e6e64) test: skip directories ignored by the go command in TestFormatting ### 📊 Changes **1 file changed** (+11 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `format_test.go` (+11 -1) </details> ### 📄 Description Fixes #195. ## Problem `TestFormatting` walks the whole source tree and gofmt-checks every `.go` file in it, including directories the go command ignores: names starting with `.` or `_`, and `testdata` (see `go help packages`). Packaging tools put `GOPATH` inside the source tree under such a name. Void's `xbps-src` uses `_build-<pkgname>-xbps`. Once the module cache there is populated, the test checks third-party code and fails: ``` --- FAIL: TestFormatting format_test.go:45: unformatted code: _build-amneziawg-go-xbps/pkg/mod/gvisor.dev/gvisor@v0.0.0-20231202080848-1f7806d17489/pkg/abi/linux/linux_arm64_abi_autogen_unsafe.go ... ``` ## Fix Skip those directories in the walk, as the go command does. The module's own code is checked exactly as before. ## Testing - Reproduced in a `golang:1.27` container with `GOPATH=$PWD/_build-amneziawg-go-xbps` after `go mod download`: 124 "unformatted code" reports, all from the module cache (gVisor, Outline SDK, x/tools, ...), and `TestFormatting` fails. With the fix it passes, and so does `go test ./...` with the in-tree `GOPATH`. - An unformatted file added under `device/` is still reported. - Unformatted files under `.gopath/` and `testdata/` are skipped, like `_build-*/`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-go#202
No description provided.