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

Go's indexing servers didn't pick up real version number for fabric #2929

Closed
yurivict opened this issue Sep 16, 2021 · 7 comments
Closed

Go's indexing servers didn't pick up real version number for fabric #2929

yurivict opened this issue Sep 16, 2021 · 7 comments

Comments

@yurivict
Copy link

I use this script to retrieve all Go packages:

$ cat go-retrieve-all-packages.sh 
#!/bin/sh

SINCE=$1 # like 2021-08-01T00:00:00Z

while [ -n "${SINCE}" ]; do

	# download
	echo "downloading SINCE=${SINCE}"
	wget "https://index.golang.org/index?limit=2000&since=${SINCE}" -q -O output-${SINCE}.json

	# get last since
	SINCE_NEW=`tail -1 output-${SINCE}.json | sed -e 's|.*"Timestamp":"||; s|".*||'`

	# EOF?
	if [ "${SINCE_NEW}" = "${SINCE}" ] || [ -z "${SINCE_NEW}" ]; then
		echo "=== End of project list reached @ ${SINCE} ==="
		exit 0
	else
		SINCE=${SINCE_NEW}
	fi
done

For example, go-retrieve-all-packages.sh 2021-09-10T00:00:00Z

fabric is registered with incorrect versions like v0.0.0-20210916200841-1243e99c1ff2, and 2.3.3 doesn't appear there.

@yurivict
Copy link
Author

My guess is that .mod file should contain module github.com/hyperledger/fabric/v2.

@denyeart
Copy link
Contributor

denyeart commented Oct 7, 2021

I believe this was done intentionally since Fabric is a top level project and not meant to be used as a dependent library by other projects.

@yurivict
Copy link
Author

yurivict commented Oct 7, 2021

I believe this was done intentionally since Fabric is a top level project and not meant to be used as a dependent library by other projects.

Top level projects also need to be registered on Go's indexing servers because package builders download project dependencies from there.

denyeart added a commit to denyeart/fabric that referenced this issue Jan 10, 2022
Although Fabric is not intended to be used as a go module that other
projects import, some projects use Go tooling to download repositories
and this does not work for Fabric v2.x since Fabric's go module is
not defined as a v2 module. This change marks Fabric's go module
as v2 so that Fabric v2.x versions can be downloaded with Go tooling.

Fixes hyperledger#2929

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
denyeart added a commit to denyeart/fabric that referenced this issue Jan 11, 2022
Although Fabric is not intended to be used as a go module that other
projects import, some projects use Go tooling to download repositories
and this does not work for Fabric v2.x since Fabric's go module is
not defined as a v2 module. This change marks Fabric's go module
as v2 so that Fabric v2.x versions can be downloaded with Go tooling.

Fixes hyperledger#2929

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
@denyeart
Copy link
Contributor

I believe this was done intentionally since Fabric is a top level project and not meant to be used as a dependent library by other projects.

Top level projects also need to be registered on Go's indexing servers because package builders download project dependencies from there.

@yurivict I've attempted a PR to update the module to v2 but it looks like there will be too many impacts across the toolchain. Since Fabric module is not intended to be used as a dependency, can you give an example of a workflow that requires the module to be v2? If you need to build Fabric from source, why not get the source from github?

@yurivict
Copy link
Author

Since Fabric module is not intended to be used as a dependency, can you give an example of a workflow that requires the module to be v2?

The FreeBSD's ports framework downloads modules from Go's servers. FreeBSD ports exist only for top-level projects.

@denyeart
Copy link
Contributor

@yurivict I've looked at other top-level Go projects that have released beyond v1, and most don't specify a version for their top-level go module (e.g. cockroachdb, prometheus, grafana). Is there some guidance from the Go community that you can point to for top-level projects? Most of the docs I've found for go module versioning are talking about go libraries that will be consumed as dependencies.

@denyeart
Copy link
Contributor

The PR proved that there were too many downstream disruptions caused by a switch to v2 for fabric module, I've had to close the PR.

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 a pull request may close this issue.

2 participants