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

Replace Apache 2.0 licensed gopkg.in/yaml.v3 with MIT licensed github.com/goccy/go-yaml #1120

Closed
wants to merge 1 commit into from

Conversation

Al2Klimov
Copy link

... to be compatible with GPLv2 applications.

@Al2Klimov
Copy link
Author

We at @Icinga are developing applications under GPLv2. Unfortunately due to its viral copyleft nature it's not compatible with the Apache 2.0 license. And even more unfortunately at the moment your MIT licensed lib depends on the Apache 2.0 licensed gopkg.in/yaml.v3 which makes it unusable for us (Icinga/icingadb#381). This PR shall fix that... mostly. Now there are only permissively licensed non-golang.org/x deps ex. gopkg.in/yaml.v2 (go mod graph |cut -d ' ' -f 2- |cut -d @ -f 1 |cut -d / -f 1-3 |sort -u). That is only required by github.com/stretchr/testify@v1.4.0 (go mod graph |grep -Fwe gopkg.in/yaml.v2) which is only required by github.com/leodido/go-urn@v1.2.0 (go mod graph |grep -Fwe github.com/stretchr/testify@v1.4.0). Only after yet another release of this lib I can continue with fixing github.com/leodido/go-urn, etc. and make another PR for you which removes the gopkg.in/yaml.v2 dep.

@Al2Klimov
Copy link
Author

Now with goccy/go-yaml#260 it should be feature-equivalent.

@dolmen dolmen added the dependencies Pull requests that update a dependency file label Oct 31, 2023
@dolmen dolmen added wontfix license About license change and removed wontfix labels Mar 7, 2024
….com/goccy/go-yaml

... to be compatible with GPLv2 applications.
Copy link
Collaborator

@dolmen dolmen left a comment

Choose a reason for hiding this comment

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

goccy/go-yaml brings too many dependencies which should not be needed for YAML serialization: go-colorable, go-isatty...

=> wontfix

@dolmen dolmen added the wontfix label Mar 7, 2024
@dolmen dolmen closed this Mar 7, 2024
@dolmen dolmen added the YAML About YAML and dependency label Mar 19, 2024
dolmen added a commit that referenced this pull request Mar 19, 2024
Make the YAML dependency required for {assert,require}.YAMLEq{,f} pluggable.

The implementation can be selected using build tags:
- testify_yaml_default (default): gopkg.in/yaml.v3 is used, like before
- testify_yaml_fail: YAML deserialization is not implemented and always
  fails. So assert.YAMLEq always fails. This is useful if the test suite
  package doesn't use assert.YAMLEq (very common case).
- testify_yaml_custom: the github.com/stretchr/testify/assert/yaml
  package exposes an Unmarshal variable of type func([]byte, any) error
  (same as gopkg.in/yaml.v3) that allows to plug any alternate
  implementation. For example github.com/goccy/go-yaml.Unmarshal.
  This allows to avoid the link constraints of the license of
  gopkg.in/yaml.v3 (see PR #1120).

Usage: go test -tags testify_yaml_fail

To install the alternate implementation with testify_yaml_custom:

	//go:build testify_yaml_custom

	package my_pkg_test

	import (
		goyaml "github.com/goccy/go-yaml"
		"github.com/stretchr/testify/assert/yaml"
	)

	func init() {
		yaml.Unmarshal = goyaml.Unmarshal
	}
dolmen added a commit that referenced this pull request Mar 31, 2024
Make the YAML dependency required for {assert,require}.YAMLEq{,f} pluggable.

The implementation can be selected using build tags:
- testify_yaml_default (default): gopkg.in/yaml.v3 is used, like before
- testify_yaml_fail: YAML deserialization is not implemented and always
  fails. So assert.YAMLEq always fails. This is useful if the test suite
  package doesn't use assert.YAMLEq (very common case).
- testify_yaml_custom: the github.com/stretchr/testify/assert/yaml
  package exposes an Unmarshal variable of type func([]byte, any) error
  (same as gopkg.in/yaml.v3) that allows to plug any alternate
  implementation. For example github.com/goccy/go-yaml.Unmarshal.
  This allows to avoid the link constraints of the license of
  gopkg.in/yaml.v3 (see PR #1120).

Usage: go test -tags testify_yaml_fail

To install the alternate implementation with testify_yaml_custom:

	//go:build testify_yaml_custom

	package my_pkg_test

	import (
		goyaml "github.com/goccy/go-yaml"
		"github.com/stretchr/testify/assert/yaml"
	)

	func init() {
		yaml.Unmarshal = goyaml.Unmarshal
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file license About license change wontfix YAML About YAML and dependency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants