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

Change strain to use generics #2701

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

junedev
Copy link
Member

@junedev junedev commented Sep 3, 2023

@andrerfcsantos suggested that "Strain" would be a good exercise for practicing generics. This PR does that. The old version of the exercise was very clunky, with generics it makes much more sense.

I added a note on generics in the stub file so people know what they are up for. I also increased the difficultly to 4 to avoid people complaining that an easy exercise needs such an "advanced" concept.

@junedev junedev added the x:rep/medium Medium amount of reputation label Sep 3, 2023
@andrerfcsantos
Copy link
Member

Looks good, thanks for this!

CI seems to be failing because of golang.org/x/exp/slices and some kind of conflict with the linter. Maybe upgrading the linter will fix this?

Also, this package is part of the standard library as of Go 1.21, so when upgrading the track to Go 1.21 we can just replace the import to use the standard library and we won't have this problem.

@junedev Do we think we should try to fix the linter issue for now or focus on upgrading to 1.21?

@junedev junedev force-pushed the migrate-strain-to-use-generics branch 5 times, most recently from f577778 to 1f9501d Compare September 8, 2023 08:50
@junedev
Copy link
Member Author

junedev commented Sep 8, 2023

I don't urgently need the slices package for this but it would have been nice.
The real error is this one (which shows when I do "go test" before running the linter):

Error: tmp/lint/practice/strain/strain_test.go:8:2: cannot find package "golang.org/x/exp/slices" in any of:
	/opt/hostedtoolcache/go/1.20.7/x64/src/golang.org/x/exp/slices (from $GOROOT)
	/home/runner/go/src/golang.org/x/exp/slices (from $GOPATH)
ok  	_/home/runner/work/go/go/tmp/lint/concept/airport_robot	0.004s
ok  	_/home/runner/work/go/go/tmp/lint/concept/animal_magic	0.004s
[...]

Not sure why the go test command is not downloading things in a way that it can access it.

@junedev junedev force-pushed the migrate-strain-to-use-generics branch 2 times, most recently from bc54e0a to 8a80c24 Compare September 8, 2023 10:57
@junedev junedev force-pushed the migrate-strain-to-use-generics branch from 8a80c24 to ecc5877 Compare September 8, 2023 11:01
@junedev junedev merged commit f9e4311 into exercism:main Sep 8, 2023
12 checks passed
@junedev junedev deleted the migrate-strain-to-use-generics branch September 8, 2023 11:16
@junedev junedev mentioned this pull request Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:rep/medium Medium amount of reputation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants