For historic reasons, which are too difficult to change (and pre-modules),
the runtime module for the ANTLR v4 Go runtime is held in a subdirectory of
the antlr/antlr4 Github repo. This is complicated by the fact that
organizations have written scripts into their build to copy the source code
into their monorepos and so on (I'm looking at you Google ;). I cannot just
put the source code into its own repo and be done with it. Also, there are
a ton of automated scripts for testing and release etc. There are something
like 45 projects within Google alone that rely on the source location and
tag presence etc.

In the past, tags with the v prefix had been created that point to the root
of the repo (to clarify, I mean the tags don't contain the prefix - I know
tags point at commit hashes). They were not created for go and people have
used them in builds - I cannot just delete them. For instance, there is a
tag v.4.11.1 which seemed to totally throw off the go get etc and while
using the path to the runtime in the import works, it meant that the entire
repo source is installed as if it were the go module, and the go.mod for a
project and the ~/go/pkg/mod shows
github.com/antlr/antlr4@v4.11.1+incompatible. I can understand why this is.

With the latest release v4.12.0, I created tags with the directory prefix:
runtime/Go/antlr/v4/v4.12.0 a la:

git tag -a v4.12.0 -m "ssads" runtime/Go/antlr/v4

And there is no v4.12.0 tag. There is a 4.12.0 tag for use by non-go users
in the future.

This seems to work in that the cache now only contains the v4 source for
go. So far so good. But when a go get is issued, the go.mod (and reflected
in cache) for a project seems to indicate the commit hash and not the
version, so the module for a project that uses it will look like this:

module x/y/z

go 1.19

require (
    github.com/antlr/antlr4/runtime/Go/antlr/v4
v4.0.0-20230219212500-1f9a474cc2dc
)

require golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect

Where I was expecting to see v4.12.0. The go.mod for the runtime is stored
inthe /v4 directory of course, but there is no other go.mod, such as at the
root of the repo.

The docs are a little light on this area, so I cannot tell if this is what
should be expected, or whether my tags are not quite correct in some way.

The current latest tag is:

https://github.com/antlr/antlr4/releases/tag/runtime%2FGo%2Fantlr%2Fv4%2Fv4.12.0

The previous incorrect tag is:

https://github.com/antlr/antlr4/releases/tag/v4.11.1

I suspect that the directory associated tag is not correct, and that:

go get -u github.com/antlr/antlr4/runtime/Go/antlr/v4

Is just getting the latest commit to master, or the commit at the point
where the tag was created. I am aware that tags point at the commit and
refer to the repo as a whole. I'm even looking suspiciously at that
uppercase G.

I suspect this because:

go get -u github.com/antlr/antlr4/runtime/Go/antlr/v4@v4.12.0
go: github.com/antlr/antlr4/runtime/Go/antlr/v4@v4.12.0: invalid version:
unknown revision runtime/Go/antlr/v4.12.0

So, I am wondering if there are any devops guys on here (I am a wizened old
coder, used to having devops guys to ask ;), that no how to do this
correctly?

Any pointers appreciated. Hopefully I am just misunderstanding something
here.

Jim

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGPPfg_JqcfWU7cFPWu2sNs11dzk2iELJry9nSVFmAeZUgqVYQ%40mail.gmail.com.

Reply via email to