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.

None yet

2 participants