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

assert: remove deprecated build constraints #1671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexandear
Copy link
Contributor

@alexandear alexandear commented Oct 30, 2024

Summary

This PR removes outdated build constraints.

Changes

Remove unnecessary // +build comments from files in the assert/yaml package.

Motivation

To cleanup the code.

The "Build constraints" says:

Go versions 1.16 and earlier used a different syntax for build constraints, with a "// +build" prefix. The gofmt command will add an equivalent //go:build constraint when encountering the older syntax.

It's a safe change because the minimum supported version by testify is Go 1.17.

@brackendawson
Copy link
Collaborator

I'm not confident enough that there aren't people out there using go <= 1.17. While we express support for 1.19 we wont do things that would break earlier versions when we don't need to.

@alexandear
Copy link
Contributor Author

I'm not confident enough that there aren't people out there using go <= 1.17. While we express support for 1.19 we wont do things that would break earlier versions when we don't need to.

@brackendawson There are no people who use testify with Go 1.16 and below because it's not possible. It simply does not compile:

❯ go1.16 build ./...
# github.com/stretchr/testify/assert
assert/assertion_compare.go:316:17: obj1Value.CanConvert undefined (type reflect.Value has no field or method CanConvert)
assert/assertion_compare.go:342:17: obj1Value.CanConvert undefined (type reflect.Value has no field or method CanConvert)
assert/assertions.go:100:23: field.IsExported undefined (type reflect.StructField has no field or method IsExported)
note: module requires Go 1.17

@brackendawson
Copy link
Collaborator

Ooh, maybe then.

@brackendawson brackendawson reopened this Oct 30, 2024
@brackendawson
Copy link
Collaborator

@dolmen added both forms of build tag far more recently than we set the go directive to 1.17. Was there a reason for adding the older form that we're not aware of?

@alexandear alexandear force-pushed the chore/remove-deprecated-build-constraints branch from e068510 to f3e6f1a Compare November 24, 2024 16:26
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