-
-
Notifications
You must be signed in to change notification settings - Fork 206
fix: unformatted go.mod which is valid leads to parse error #1803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Could you please fix the linting issues? Most, if not all, can be fixed by running eg Other than that, looks good to me! Thanks for the PR! |
Still discussing about what to do with the toolchain. Ideally, it should go into the formulation section. Maybe we do this in a separate PR to keep this going. |
I'd say let's do that in a separate PR, might be a bit much to throw that in here... |
Signed-off-by: 叶飞杨 <yefeiyang@yealink.com>
Is there some reason for not using for (const f of gomodFiles) {
const result = spawnSync("go", ["mod", "edit", "--fmt", f], {
cwd: basePath,
encoding: "utf-8",
timeout: TIMEOUT_MS,
maxBuffer: MAX_BUFFER,
});
// Check if format go.mod successfully
if (result.status !== 0 || result.error) {
console.warn(`go mod edit --fmt ${f} command has failed.`);
if (DEBUG_MODE && result.stderr) {
console.log(result.stderr);
}
}
} |
have open a PR for
have opened a separate PR: #1805 |
I assume this is because we don't want to change any files in your project. When you have a different, valid formatting in your files, it is probably there for a reason (even if personal preference) and we should not change this. Maybe it doesn't matter for go, there are however tools where changing files resolves in issues with the build and we should not be the reason builds break. @prabhu: Or am I completely wrong and should we add formatting and a big disclaimer? |
Again, thanks for this PR! |
That is correct. We should move to a model where the source (directory, image, and binary) remains unmodified after the BOM generation. We only need write access to the some output files and a temp directory. With --install-deps or --deep arguments, we install packages and run tools like atom that taint the input environment, which is also a risk since the tool now becomes an attack vector. |
tab
is valid char as a sperater for go.modi wonder if runing
go mod edit --fmt
before parsego.mod
will be a better way