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

Check lxd-agent imports #13219

Merged
merged 3 commits into from
Apr 2, 2024
Merged

Conversation

simondeziel
Copy link
Member

No description provided.


echo "Checking for imports that have been added to the lxd-agent..."

OUT=$(go list -f '{{ join .Imports "\n" }}' ./lxd-agent | grep -F . | sort -u | diff -u test/lxd-agent-godeps.list - || true)
Copy link
Member Author

Choose a reason for hiding this comment

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

@tomponline is it enough to check ./lxd-agent alone here?

Copy link
Member

Choose a reason for hiding this comment

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

This seems to only track the packages explicitly imported, and not any additional chained dependencies (which was the problem we saw before).

It looks like we can do go list -f '{{ join .Deps "\n" }}' ./lxd-agent to get the full list.

And I wonder if we shouldn't also be doing that for ./client and ./lxc separately (rather than combined as it is now). Then we wouldn't need to also check ./lxc/config as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. Would you like me to put them all in a single script each comparing against a godeps.list file? Or you'd prefer 3 scripts (client, lxc & lxd-agent)?

In any case, I'm not sure what to do of ./shared/api if you want me to rework client-imports.sh.

Copy link
Member

Choose a reason for hiding this comment

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

I don't mind how many scripts - but I think we should have a godeps.list file for each (client, lxc, lxd-agent and shared/api).

@simondeziel simondeziel marked this pull request as ready for review March 27, 2024 00:52
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@simondeziel
Copy link
Member Author

@tomponline in the lxd-agent-godeps.list files, there are many thing that feel unwanted to my untrained eye like:

github.com/beorn7/perks/quantile
github.com/canonical/go-dqlite
github.com/canonical/lxd/lxd/bgp
github.com/canonical/lxd/lxd/cgroup
github.com/canonical/lxd/lxd/cluster/config
github.com/canonical/lxd/lxd/db
github.com/canonical/lxd/lxd/dns
github.com/canonical/lxd/lxd/endpoints
github.com/canonical/lxd/lxd/firewall
github.com/canonical/lxd/lxd/idmap
github.com/canonical/lxd/lxd/instance/instancetype
github.com/canonical/lxd/lxd/maas
github.com/canonical/lxd/lxd/scriptlet/load
github.com/canonical/lxd/lxd/ucred
github.com/cenkalti/backoff/v4
github.com/juju/*
github.com/mattn/go-sqlite3
github.com/miekg/dns
github.com/openfga/*
github.com/osrg/gobgp/v3/pkg/packet/bgp
github.com/osrg/gobgp/v3/pkg/zebra
github.com/Rican7/retry/*
github.com/vishvananda/netns
github.com/robfig/cron/v3
github.com/zitadel/oidc/*
golang.org/x/crypto/blowfish                    # is that due to having sftp capability?
golang.org/x/oauth2/*

Aside from this partial and inaccurate list, I noticed the following oddities:

github.com/juju/mgo/v2/bson
github.com/juju/mgo/v2/internal/json
...
gopkg.in/mgo.v2/bson
gopkg.in/mgo.v2/internal/json
...
gopkg.in/yaml.v2
gopkg.in/yaml.v3

So 2 duplicated mgo/v2 modules and 2 versions of yaml.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@tomponline
Copy link
Member

@simondeziel im sure there are lots of improvements that can be made - please can you open an issue for that. Some will not be possible to fix because of indirect dependencies though.

@tomponline
Copy link
Member

@simondeziel please can we use the same .Deps list for client, shared/api and lxc too.

@tomponline tomponline merged commit 56cf436 into canonical:main Apr 2, 2024
29 checks passed
@simondeziel simondeziel deleted the lxd-agent-imports branch April 4, 2024 19:15
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 this pull request may close these issues.

2 participants