chore: fix string formatting and ST1005 linter warning in file permission errors

Open Beginner friendly
#535 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
92/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
cli

Research direction

Start with pkg/config/file_permission_unix.go:30 and pkg/config/file_permission_windows.go:30, where getFilePermission() constructs the error. Run staticcheck ./... to confirm the ST1005 warnings. Done means the invalid-permission message has the expected spacing, no trailing punctuation, and staticcheck passes.

Written by the indexing model from the issue text.

Description

Describe the bug

In pkg/config/file_permission_unix.go and pkg/config/file_permission_windows.go, the error returned by getFilePermission() is split across two concatenated string literals:

return fmt.Errorf("config file has incorrect permission flags:%s."+
	"change the file permission either to 0400 or 0600.", fi.Mode().Perm().S

Two small issues with this:

  1. Missing spaces in the string: there is no space after the colon (flags:%s), and no space between the period and "change" (.change), causing words to run together in terminal output.
  2. Trailing punctuation: ending the error message with a period triggers a staticcheck warning (ST1005: error strings should not end with punctuation or newlines).
Expected behavior

The error message should have clean spacing and omit trailing punctuation to follow Go conventions:

config file has incorrect permission flags: %s, change the file permission either to 0400 or 0600
Actual behavior

When an invalid file mode is encountered, the output text runs together:

config file has incorrect permission flags:-rw-r--r--.change the file permission either to 0400 or 0600.

And staticcheck reports:

pkg/config/file_permission_unix.go:30:9: error strings should not end with punctuation or newlines (ST1005)
How to Reproduce?
  1. Inspect pkg/config/file_permission_unix.go:30 or pkg/config/file_permission_windows.go:30.
  2. Run staticcheck ./... locally.
  3. Observe the ST1005 warning.
Microcks version or git rev

main (Latest)

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

CLI

Additional information

Minor cleanup to fix terminal output formatting and ensure clean staticcheck runs.

cc @Harsh4902

Dominant language
Go
Stars
52
Forks
67
Avg merge
1d 1h
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microcks/microcks-cli

All issues in microcks/microcks-cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.