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

Upgraded Go 1.15 #1105

Merged
merged 2 commits into from
Aug 27, 2020
Merged

Upgraded Go 1.15 #1105

merged 2 commits into from
Aug 27, 2020

Conversation

huydoan2
Copy link
Contributor

No description provided.

@mrutkows
Copy link
Contributor

mrutkows commented Aug 27, 2020

It appears some of the type conversions in go 1.15 now behave slightly differently (perhaps) in error responses generated.

# github.com/apache/openwhisk-wskdeploy/parsers

parsers/manifest_parser_test.go:1742:21: conversion from untyped int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
parsers/manifest_parser_test.go:1743:19: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
parsers/manifest_parser_test.go:1751:22: conversion from untyped int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
parsers/manifest_parser_test.go:1752:20: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
parsers/manifest_parser_test.go:1771:22: conversion from untyped int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
parsers/manifest_parser_test.go:1772:20: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)

@mrutkows
Copy link
Contributor

mrutkows commented Aug 27, 2020

Here is the code area of interest for the first error (1742,1743):

m, err := testReadAndUnmarshalManifest(t, "../tests/dat/manifest_data_unmarshal_packages.yaml")

	// Unmarshal reads/parses manifest data and sets the values of YAML
	// And returns an error if parsing a manifest data fails
	if err == nil {
		expectedResult := string(2)  // <= 1742
		actualResult := string(len(m.Packages)) // <== 1743
		assert.Equal(t, expectedResult, actualResult, "Expected 2 packages but got "+actualResult)

So it appears the string constructor now fails given a uint and requires us to use sprintf to construct the string provided to the assert.

@huydoan2
Copy link
Contributor Author

Notes about Go 1.15 and string(x): https://golang.org/doc/go1.15#vet

Copy link
Contributor

@mrutkows mrutkows left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the change of string(n) behavior in our unit tests.

@mrutkows mrutkows merged commit 535f5a9 into apache:master Aug 27, 2020
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