Skip to content

fix: add go.mod, fix test example names and printf format warning - #20

Open
aoright wants to merge 1 commit into
pmezard:masterfrom
aoright:fix/test-example-names-and-go-mod
Open

fix: add go.mod, fix test example names and printf format warning#20
aoright wants to merge 1 commit into
pmezard:masterfrom
aoright:fix/test-example-names-and-go-mod

Conversation

@aoright

@aoright aoright commented Aug 20, 2026

Copy link
Copy Markdown

Problem

  1. In modern Go toolchains (go test / go vet), difflib_test.go fails to compile because example function names (ExampleGetUnifiedDiffCode, ExampleGetContextDiffCode) reference unknown identifiers, and fmt.Printf is called with a dynamic format string.
  2. Lack of go.mod causes module-aware tooling to require GOPATH mode.

Fix

  • Add go.mod definition for github.com/pmezard/go-difflib.
  • Rename ExampleGetUnifiedDiffCode to ExampleGetUnifiedDiffString and ExampleGetContextDiffCode to ExampleGetContextDiffString_format.
  • Replace fmt.Printf with fmt.Print in ExampleGetContextDiffString.

Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant