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

cmd/go: failing to resolve nested modules in tagged fossil repos #64104

Closed
LordPraslea opened this issue Nov 13, 2023 · 6 comments
Closed

cmd/go: failing to resolve nested modules in tagged fossil repos #64104

LordPraslea opened this issue Nov 13, 2023 · 6 comments
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@LordPraslea
Copy link

LordPraslea commented Nov 13, 2023

I've spent more than 3 days figuring out what the heck is wrong with GO in combination with fossil SCM. Solved various errors but the projects.local/pizzeria/pizza: module projects.local/pizzeria/pizza@latest found (v0.0.0-20231113162218-fcd622746656), but does not contain package projects.local/pizzeria/pizza error is
simply nerve wrecking.

What version of Go are you using (go version)?

go version go1.21.1 linux/amd64

Does this issue reproduce with the latest release?

Yes, tested it with 1.19 aswell. same issue. Experimetned with multiple versions. Same thing.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/myuser/.cache/go-build'
GOENV='/home/myuser/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/myuser/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/myuser/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/myuser/Projects/pizzaexperiment/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3730884489=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Sample project: see attached file. A simple project with modules and submodules.

pizzeria.go:

package main

import (
	"fmt"

	"projects.local/pizzeria/pizza"
)

// Great pizza!
func main() {
	fmt.Println("Welcome to Luigi's pizzeria!")
	fmt.Println(" Prepared your pizza ", pizza.MakePizza())
}

go.mod

module projects.local/pizzeria

go 1.21.1

pizza/tasty.go:

package pizza

import (
	"fmt"

	"projects.local/pizzeria/pizza/toppings"
)

type Pizza struct {
	Toppings []string
	Price    float32
	Version  string
}

func MakePizza() Pizza {

	return Pizza{Toppings: toppings.Toppings(), Price: 11.77, Version: "0.0.1"}
}

func PizzaDisplay(pizza Pizza) {
	fmt.Println("Your pizza contains ", pizza.Toppings, "Price $", pizza.Price, " Version ", pizza.Version)
}

pizza/go.mod

module projects.local/pizzeria/pizza

go 1.21.1

pizza/toppings/good.go

package toppings

func Toppings() []string {
	return []string{"cheese", "sauce", "garlic"}
}

pizza/toppings/go.mod

module projects.local/pizzeria/pizza/toppings

go 1.21.1

Go mod tidy and go get fails for ALL types of projects which contain modules and submodules using Fossil Scm - Including the same project it's in!

Any command such as go get/go mod tidy fails. I experimented with workspaces. When I experimented with a self hosted GIT and it only works untill I push tags, then if I want a specific tag, it fails again, which makes me think there is a huge bug somewhere in the go implementation and usage of Fossil & git. Or I might be using it wrong. I tagged versions with both fossil & git and tried keeping my repo\s the same.

The data in the zip files and folders located at /home/myuser/go/pkg/mod/cache/download/projects.local/pizzeria and /home/myuser/go/pkg/mod/cache/download/projects.local/pizzeria/toppings are all empty in fossil and only seem to contain data when using a Git repo.

I tried adding tags to projects.local/pizzeria and even code.myproject.local/pizzeria-example/ which fail

A local NGINX/Caddy instance exists to redirect projects.local (mapped to local IP in /etc/hosts) the correct code.myproject.local (which reverse proxies both fossil & git) including redirecting meta
<-

IN essence everything is set up for this to work correctly but it still won't work properly.
Is there a different folder structure required with fossil? I've searched the net wide and open for examples, read documentation and even experimented with chiselapp which gives the same error. For most projects. This is a big dealbreaker.

Due to various constraints, the projects require Fossil.

What did you expect to see?

GOPRIVATE=.local,projects.local/pizzeria GOVCS=*:all GOPROXY=direct go mod tidy
go: finding module for package projects.local/pizzeria/pizza
go: downloading projects.local/pizzeria v0.0.0-20231113171659-96083a33d6b9
go: downloading projects.local/pizzeria/pizza v0.0.0-20231113171659-96083a33d6b9
go: found projects.local/pizzeria/pizza in projects.local/pizzeria/pizza v0.0.0-20231113171659-96083a33d6b9
go: finding module for package projects.local/pizzeria/pizza/toppings
go: downloading projects.local/pizzeria/pizza/toppings v0.0.0-20231113171659-96083a33d6b9
go: found projects.local/pizzeria/pizza/toppings in projects.local/pizzeria/pizza/toppings v0.0.0-20231113171659-96083a33d6b9

(the above example uses a local GIt service which does seem to work UNTILL i push a tag and sync it, afterwards, when fetching a specific versioned module, it fails as with git)

What did you see instead?

GOPRIVATE=.local,projects.local/pizzeria GOVCS=*:all GOPROXY=direct go mod tidy
go: finding module for package projects.local/pizzeria/pizza
go: downloading projects.local/pizzeria/pizza v0.0.0-20231113162218-fcd622746656
go: downloading projects.local/pizzeria v0.0.0-20231113162218-fcd622746656
go: pizzatest imports
projects.local/pizzeria/pizza: module projects.local/pizzeria/pizza@latest found (v0.0.0-20231113162218-fcd622746656), but does not contain package projects.local/pizzeria/pizza

@bcmills
Copy link
Contributor

bcmills commented Nov 13, 2023

I tried adding tags to projects.local/pizzeria and even code.myproject.local/pizzeria-example/ which fail

What were the exact tags that you added? Note that for a module in the pizza subdirectory, the tag would need to be something like pizza/v0.1.0 rather than just v0.1.0. (See https://go.dev/ref/mod#vcs-version.)

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. GoCommand cmd/go modules labels Nov 13, 2023
@LordPraslea
Copy link
Author

I tried adding tags to projects.local/pizzeria and even code.myproject.local/pizzeria-example/ which fail

What were the exact tags that you added? Note that for a module in the pizza subdirectory, the tag would need to be something like pizza/v0.1.0 rather than just v0.1.0. (See https://go.dev/ref/mod#vcs-version.)

fossil tag ls

pizza/toppings/v0.1.0
pizza/v0.1.0
pizza/v0.2.0
pizzeria/pizza/v0.1.0
projects.local/pizzeria/pizza/v0.1.0
trunk
v0.1.0

git tag

pizza/toppings/v0.1.0
pizza/v0.2.0
v0.1.0

Both are sync'ed and visible in user interfaces aswell, tagged to the specific Checkout.

@bcmills
Copy link
Contributor

bcmills commented Nov 14, 2023

Thanks. I wouldn't be terribly surprised if we have some bugs in the fossil extraction path, but we also don't have very many users who rely on it (and we have very little expertise with the fossil command line).

If you could send a CL to add a test that reproduces the problem, I can review and/or attempt to write a fix.

The scripts to build fossil test repos are in src/cmd/go/testdata/vcstest/fossil, and the scripts that drive the tests themselves are in src/cmd/go/testdata/script. (See, for example, version_buildvcs_fossil.txt and mod_get_fossil.txt, which use the repo built from hello.txt.)

@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 14, 2023
@bcmills bcmills added this to the Backlog milestone Nov 14, 2023
@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. help wanted labels Nov 14, 2023
@bcmills bcmills changed the title go fossil scm module never finding packages tagged - module found but does not contain package cmd/go: failing to resolve nested modules in tagged fossil repos Nov 14, 2023
@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed help wanted labels Nov 14, 2023
@LordPraslea
Copy link
Author

Hi

I skimmed that link fast. It seems terribly convoluted. Is gerrith mandatory or can one use github for that purpose?
Say there is a fix available within +1-3 days, how long would it on take on average before it would be included in a new go release?

We're looking at temporary workaround solutions

@bcmills
Copy link
Contributor

bcmills commented Jan 26, 2024

You can start a code review using either GitHub or Gerrit, but the review itself always happens on Gerrit.

Go has two major releases per year, but we also backport critical, low-risk fixes two the two most recent releases about once a month. So the time from commit to a major release can be as long as ~6 months, or as little as ~1 month.

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jan 28, 2024
@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants