Skip to content

refactor: Use fs.FS interface instead of os file access#63

Merged
phisco merged 1 commit into
crossplane-contrib:mainfrom
MisterMX:refactor/fs-interface
Jan 24, 2024
Merged

refactor: Use fs.FS interface instead of os file access#63
phisco merged 1 commit into
crossplane-contrib:mainfrom
MisterMX:refactor/fs-interface

Conversation

@MisterMX

@MisterMX MisterMX commented Jan 22, 2024

Copy link
Copy Markdown
Contributor

Description of your changes

Replace all IO operations based on the os package with the ones from the abstract fs package and pass a fsys parameter down to functions that need it.

Use embed.FS in tests.

Depends on #62

I have:

@MisterMX MisterMX changed the title refactor: Use fs.FS interface instead of os file access refactor: Use fs.FS interface instead of os file access Jan 22, 2024
@MisterMX
MisterMX force-pushed the refactor/fs-interface branch from f224b58 to 070c8cb Compare January 22, 2024 13:06
Replace all IO operations based on the `os` package with the ones from
the abstract `fs` package and pass a `fsys` parameter down to functions
that need it.

Use a custom `osFS` in main() that just wrap around `os.Open`.
Use `embed.FS` in tests.

Signed-off-by: Maximilian Blatt <maximilian.blatt-extern@deutschebahn.com>
@MisterMX
MisterMX force-pushed the refactor/fs-interface branch 2 times, most recently from 5482acb to 1e44f6c Compare January 24, 2024 08:37
@MisterMX

Copy link
Copy Markdown
Contributor Author

Updated this PR and removed the dependency on #62.

@MisterMX
MisterMX force-pushed the refactor/fs-interface branch from 1e44f6c to a3a0cca Compare January 24, 2024 08:40
Comment thread main.go Outdated

@phisco phisco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks @MisterMX

@MisterMX
MisterMX force-pushed the refactor/fs-interface branch 3 times, most recently from 21e7fb2 to 966acd6 Compare January 24, 2024 09:12

@ezgidemirel ezgidemirel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @MisterMX, LGTM!

@phisco
phisco merged commit b1998a7 into crossplane-contrib:main Jan 24, 2024
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.

3 participants