Skip to content
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

customimages:chore - avoid type casting and add tests #770

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

matheusalcantarazup
Copy link
Contributor

Previously the implementation of CustomImages map was a bit redundant.
Basically a map[string]string was created using the string
representation of each languages.language as key, and when were we going
to access this map we always receive a languages.Language and need to get
the string representation of this language, which make an unnecessary type
casting.

This commit change the type of CustomImages to store a
languages.Language as key and avoid these type casting.

The function NewCustomImages was renamed to Default to make more
clear and a new function MustParseCustomImages was created to parse
the input taken from Viper.

This commit also add some new tests to assert the default values and
test the parsing.

Updates #718

Signed-off-by: Matheus Alcantara matheus.alcantara@zup.com.br

- What I did

- How to verify it

- Description for the changelog

Previously the implementation of CustomImages map was a bit redundant.
Basically a map[string]string was created using the string
representation of each languages.language as key, and when were we going
to access this map we always receive a languages.Language and need to get
the string representation of this language, which make an unnecessary type
casting.

This commit change the type of CustomImages to store a
languages.Language as key and avoid these type casting.

The function `NewCustomImages` was renamed to `Default` to make more
clear and a new function `MustParseCustomImages` was created to parse
the input taken from Viper.

This commit also add some new tests to assert the default values and
test the parsing.

Updates #718

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
@wiliansilvazup wiliansilvazup changed the title customimages:chore: avoid type casting and add tests customimages:chore - avoid type casting and add tests Nov 12, 2021
@matheusalcantarazup matheusalcantarazup marked this pull request as ready for review November 12, 2021 17:25
@matheusalcantarazup matheusalcantarazup merged commit a6886d5 into main Nov 17, 2021
@matheusalcantarazup matheusalcantarazup deleted the tests-custom-images branch November 17, 2021 12:31
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.

2 participants