Skip to content

refactor: remove redundant HasPrefix check before TrimPrefix - #532

Merged
Harsh4902 merged 2 commits into
microcks:masterfrom
ish-g09:fix/remove-redundant-has-prefix
Sep 21, 2026
Merged

Harsh4902 merged 2 commits into
microcks:masterfrom
ish-g09:fix/remove-redundant-has-prefix

Conversation

@ish-g09

@ish-g09 ish-g09 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

###Description

  • Removed the redundant if 'strings.HasPrefix(f, "./")' check in 'cmd/import.go'
  • Replaced strings.TrimPrefix with filepath.Clean(f) to provide robust path normalisation (handling redundant prefixes like ././ and platform-specific path separators such as Windows .\) for fsnotify watch events
  • This reduces cyclomatic complexity with no change in behaviour
  • All existing tests pass

###Related issue(s)
Fixes #526

###AI Disclosure
The code change was written and verified by me, I fully understand it.

Testing

  • go build ./... : passes
  • go test ./... : all packages pass

Signed-off-by: ish-g09 <ig.valiente09@gmail.com>
Comment thread cmd/import.go Outdated
Signed-off-by: ish-g09 <ig.valiente09@gmail.com>
@Vaishnav88sk

Copy link
Copy Markdown
Contributor

LGTM 👍🏻

@Harsh4902 Harsh4902 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

GTG

@Harsh4902
Harsh4902 merged commit c4e1d5e into microcks:master Sep 21, 2026
4 checks passed
@ish-g09
ish-g09 deleted the fix/remove-redundant-has-prefix branch September 21, 2026 14:15

This branch was successfully deployed

1 active deployment
Build f5a63b55 Deployed Sep 20, 2026 by ish-g09 via build-verify-package #704
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.

refactor: remove redundant strings.HasPrefix check before strings.TrimPrefix

3 participants