Skip to content

Conversation

@bobg
Copy link
Owner

@bobg bobg commented Nov 22, 2025

This PR causes NameForMethods to be choosier about which matching interface it returns.

It chooses one from the Go standard library if possible, otherwise from the "main module" if possible, otherwise from any modules directly depended on by the main module, and finally from any other module.

Within each of those categories, it prefers one closer to its module root, and one that isn't a type alias.

This includes an incompatible API change, which is tolerable since the module is still at major version 0.

Fixes #11

@github-actions
Copy link

github-actions bot commented Nov 22, 2025

Modver result

This report was generated by Modver,
a Go package and command that helps you obey semantic versioning rules in your Go module.

This PR requires an increase in your module’s major version number.
If the new major version number is 2 or greater,
you must also add or update the version suffix
on the module path defined in your go.mod file.
See the Go Modules Reference for more info.

checking Checker.NameForMethods
  in results of func(inp github.com/bobg/decouple.MethodMap) string
    1 param(s) to 2
      Major

@coveralls
Copy link

coveralls commented Nov 22, 2025

Pull Request Test Coverage Report for Build 19598707356

Details

  • 102 of 111 (91.89%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+1.1%) to 80.199%

Changes Missing Coverage Covered Lines Changed/Added Lines %
decouple.go 93 95 97.89%
cmd/decouple/main.go 5 12 41.67%
Files with Coverage Reduction New Missed Lines %
cmd/decouple/main.go 1 65.38%
decouple.go 1 81.52%
Totals Coverage Status
Change from base Build 13279069230: 1.1%
Covered Lines: 725
Relevant Lines: 904

💛 - Coveralls

@bobg bobg merged commit 2489420 into main Nov 22, 2025
1 check passed
@bobg bobg deleted the bobg/preferred-interfaces branch November 22, 2025 18:39
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.

Be more judicious about selecting named interfaces

3 participants