-
-
Notifications
You must be signed in to change notification settings - Fork 500
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
doc fix: make file permission examples octal #1510
Conversation
Examples of file permissions should be in octal format. But in the code examples they are not.
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
docs/features/copy_file.md
Outdated
@@ -14,7 +14,7 @@ nginxC, err := GenericContainer(ctx, GenericContainerRequest{ | |||
Started: true, | |||
}) | |||
|
|||
nginxC.CopyFileToContainer(ctx, "./testdata/hello.sh", "/hello_copy.sh", 700) | |||
nginxC.CopyFileToContainer(ctx, "./testdata/hello.sh", "/hello_copy.sh", 0700) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a linter for that provided by golangci but it usually suggest something like that
nginxC.CopyFileToContainer(ctx, "./testdata/hello.sh", "/hello_copy.sh", 0700) | |
nginxC.CopyFileToContainer(ctx, "./testdata/hello.sh", "/hello_copy.sh", 0o700) |
If you find the linter it would worth adding it to golangci lint config with your PR , don't you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a newbie in golang, so maybe I'm wrong, but...
It seems golangci-lint doesn't have a check for octals: https://golangci-lint.run/usage/linters/
go-critic has such a check, but go-critic is not used in this repo: https://go-critic.com/overview.html#octalliteral
Do you want me to change the examle code to the suggested 0o... format anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow gocritic advice. Gocritic can be added in a second time to golangci-lint config
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martin-mfg thanks for this super tiny and valuable change in our docs!
Because we are in the transition plan to migrate the inline snippets to executable Go example tests, I'm merging this as is, although at some point we will eliminate any inline snippet in favour of examples.
Before #1498, I'd have asked you to look for any other file permission usage in the library, so we can update it to the octal format, but I noticed @mmorel-35 already added a lint step for it in that PR.
Therefore, LGTM!
* main: Golangci-lint for all go-modules (testcontainers#1498) doc fix: make file permission examples octal (testcontainers#1510) Add "new badge" in header (testcontainers#1512)
Examples of file permissions should be in octal format. But in the code examples they are not. This PR fixes that.
What does this PR do?
Change examples in docs.
Why is it important?
Docs should be correct.