Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@matthewhartstonge
Copy link

@matthewhartstonge matthewhartstonge commented Nov 4, 2025

Aims to fix #1412

Couple of thoughts:

  • I removed the mutex as I build the required config on load due to requiring transforming. This could be optimised by making load() take in both buildTags and a *package.Config so it's only processed and in memory once.
  • The previous build tag test never compiled, which leads to a panic, which is then hidden due to the graceful recover code. Wondering if it's best to remove the test? I changed the test sample name from SampleCodeBuildTag => SampleCodeCompilationFail and added should not panic if a file can not compile as a test case

@ccojocar
Copy link
Member

ccojocar commented Nov 4, 2025

Please could you fix the lint warnings?

trackSuppressions bool
concurrency int
analyzerSet *analyzers.AnalyzerSet
mu sync.Mutex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was required to remove this mutex? How is related to this change?

// step 2/2: pass in cli encoded build flags to build correctly.
conf := &packages.Config{
Mode: LoadMode,
BuildFlags: CLIBuildTags(buildTags),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ins't this the only fix required to get properly the build flags propagated? Why's the reason for the extended refactoring?

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.

Build tags not propagating correctly

2 participants