googleapis / googleapis/google-cloud-go

spanner: go.sum is 8x bigger than other packages and inclues versions of all other subpackages

Open
#10,991 0 comments 0 reactions 1 assignee Claimed by @harshachinta View on GitHub
api: spanner triage me
Dominant language
Go
Stars
4.5k
Forks
1.6k
Avg merge
1d 13h
Merged PRs (30d)
109

Description

## Client

Spanner

## Code and Dependencies

```sh
# Print the number of lines in go.sum for each package
find . -name 'go.sum' -maxdepth 2 -print0 | xargs -0 -I{} wc -l {} | sort -nr | head -20

1616 ./spanner/go.sum
206 ./storage/go.sum
203 ./bigquery/go.sum
192 ./bigtable/go.sum
191 ./profiler/go.sum
174 ./pubsublite/go.sum
174 ./pubsub/go.sum
172 ./logging/go.sum
172 ./go.sum
170 ./asset/go.sum
168 ./kms/go.sum
168 ./containeranalysis/go.sum
166 ./vertexai/go.sum
166 ./translate/go.sum
166 ./secretmanager/go.sum
166 ./iam/go.sum
166 ./firestore/go.sum
166 ./datastore/go.sum
164 ./workstations/go.sum
164 ./vmwareengine/go.sum
```

## Expected behavior

I expect the Spanner go.sum to be comparable in size to other packages in this repo, about 200 lines of related dependencies.

## Actual behavior

The Spanner go.sum is 1600 lines versus ~200 lines for other packages. It includes multiple versions of every other sub-package in this repo, sqlite, and a host of other entries.

## Additional context

Likely caused by cyclic imports, similar to https://github.com/golang/protobuf/issues/1204.

- `cloud.google.com/go/spanner` depends on [`google.golang.org/genproto`](https://github.com/googleapis/go-genproto/blob/main/go.mod).
- `google.golang.org/genproto` depends `cloud.google.com/go/spanner`

The cycle causes the minimal version selection algorithm to pull in all (most?) tagged versions. For example, https://github.com/googleapis/google-cloud-go/blob/main/spanner/go.sum#L124C1-L135C92:

```
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA=
cloud.google.com/go/bigquery v1.43.0/go.mod h1:ZMQcXHsl+xmU1z36G2jNGZmKp9zNY5BUua5wDgmNCfw=
cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1+dFsvaChGc=
cloud.google.com/go/bigquery v1.47.0/go.mod h1:sA9XOgy0A8vQK9+MWhEQTY6Tix87M/ZurWFIxmF9I/E=
cloud.google.com/go/bigquery v1.48.0/go.mod h1:QAwSz+ipNgfL5jxiaK7weyOhzdoAy1zFm0Nf1fysJac=
cloud.google.com/go/bigquery v1.49.0/go.mod h1:Sv8hMmTFFYBlt/ftw2uN6dFdQPzBlREY9yBh7Oy7/4Q=
cloud.google.com/go/bigquery v1.50.0/go.mod h1:YrleYEh2pSEbgTBZYMJ5SuSr0ML3ypjRB1zgf7pvQLU=
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.