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

Move to golang 1.18 and later #1522

Merged
merged 1 commit into from Apr 4, 2023
Merged

Move to golang 1.18 and later #1522

merged 1 commit into from Apr 4, 2023

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Feb 27, 2023

Github.com is reporting security issues on older versions of golang.

@rhatdan
Copy link
Member Author

rhatdan commented Feb 27, 2023

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@@ -256,8 +256,9 @@ func TestCopyErrDstNotDir(t *testing.T) {
//

// A. SRC specifies a file and DST (no trailing path separator) doesn't
// exist. This should create a file with the name DST and copy the
// contents of the source file into it.
//
Copy link
Member

Choose a reason for hiding this comment

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

Extra blank line added in the middle of a paragraph. Happens several times below as well, and in meminfo_*.go.

Copy link
Member Author

Choose a reason for hiding this comment

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

This patch was done with:

$ find . -name *go -exec gofmt -s -w {} ; -print

Followed by make vendor-in-container.

Copy link
Member

Choose a reason for hiding this comment

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

This patch was done with:

$ find . -name *go -exec gofmt -s -w {} ; -print

Okay, that would also modify sources in vendored dependencies, which we don't want to be doing.

Followed by make vendor-in-container.

The target doesn't touch vendored dependencies under tests/tools, which I think is what this warning notification was focusing on. Maybe go get golang.org/x/sys && go mod vendor && go mod tidy from there?

Copy link
Member

Choose a reason for hiding this comment

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

This has not been resolved.

@nalind
Copy link
Member

nalind commented Feb 27, 2023

This modifies many files under tests/tools/vendor, but not tests/tools/vendor/modules.txt. What's going on there?

@rhatdan rhatdan force-pushed the VENDOR branch 2 times, most recently from 3f23a3c to 602f16b Compare February 27, 2023 14:48
@rhatdan
Copy link
Member Author

rhatdan commented Feb 27, 2023

@cevich Any idea on the vendor failure. Is this a matter of updating the golang inside of the VMs?

@cevich
Copy link
Member

cevich commented Feb 27, 2023

That's strange...the fedora 37 VMs should be on 1.19...looking...

@cevich
Copy link
Member

cevich commented Feb 27, 2023

...oh! This task is running in a container, that's where the version comes from. In .cirrus.yml:

vendor_task:
    container:
        image: golang
    modules_cache:
        fingerprint_script: cat go.sum
        folder: $GOPATH/pkg/mod
    build_script: make vendor
    test_script: hack/tree_status.sh

That's confusing. It means multiple files need to be updated to reflect a new version in CI. Ugg. Let me see if I can make this task follow the latest Fedora VM instead...

@cevich
Copy link
Member

cevich commented Feb 27, 2023

...nvm, it seems you know what you're doing.

@nalind
Copy link
Member

nalind commented Feb 28, 2023

This may also require a bump to the version of the linter installed in tests/tools/Makefile.

@rhatdan rhatdan force-pushed the VENDOR branch 2 times, most recently from c210f33 to 79904c7 Compare March 5, 2023 14:39
@rhatdan rhatdan force-pushed the VENDOR branch 14 times, most recently from 07174e4 to e9121ae Compare March 31, 2023 17:20
@rhatdan rhatdan force-pushed the VENDOR branch 3 times, most recently from e2a8747 to 0765cc7 Compare April 1, 2023 15:42
@rhatdan
Copy link
Member Author

rhatdan commented Apr 1, 2023

@nalind Any idea what is going wrong now?

@nalind
Copy link
Member

nalind commented Apr 3, 2023

When I ran it locally, "mount-image" (image-mount.bats:17) failed because btrfs driver does not support mount options (it won't say which one), and "container-on-mounted-image" (image-mount.bats:79) failed because it tried to create an image with the same name as one it has just created (a copy/paste error?).
The other "mount-image" (mount.bats:51) fails because the CLI test helper understands "-r" and "--ro", but not "--read-only" (either the test or the helper should be updated).

@rhatdan
Copy link
Member Author

rhatdan commented Apr 3, 2023

Thanks for pointing to those files, which I have no idea where they came from.

@@ -21,7 +21,8 @@ import (
// ├── d2 # opaque, 0750
// │   └── f1 # empty file, 0660
// └── d3 # 0700
// └── f1 # whiteout, 0000
//
Copy link
Member

Choose a reason for hiding this comment

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

Extra blank line inserted here for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

GO fmt is doing this I belive.

@@ -398,7 +398,8 @@ func prepareMetadata(manifest []byte) ([]*internal.FileMetadata, error) {
toc, err := unmarshalToc(manifest)
if err != nil {
// ignore errors here. They might be caused by a different manifest format.
return nil, nil
logrus.Debugf("could not unmasshal manifest: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

Typo: "unmasshal" should be "unmarshal".

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -149,7 +150,7 @@ func readEstargzChunkedManifest(blobStream ImageSourceSeekable, blobSize int64,
// readZstdChunkedManifest reads the zstd:chunked manifest from the seekable stream blobStream. The blob total size must
// be specified.
// This function uses the io.github.containers.zstd-chunked. annotations when specified.
func readZstdChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, annotations map[string]string) ([]byte, int64, error) {
func readZstdChunkedManifest(ctx context.Context, blobStream ImageSourceSeekable, blobSize int64, annotations map[string]string) ([]byte, int64, error) {
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason behind adding the context argument here? It doesn't appear to be used.

Copy link
Member Author

Choose a reason for hiding this comment

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

There was a linter that was complaining about it, so I added it and then had to nolint below. I can remove this, but I think we should start to use more of the linters for storage.

Copy link
Member Author

Choose a reason for hiding this comment

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

  •   decoder, err := zstd.NewReader(nil) //nolint:contextcheck
    

Copy link
Member Author

Choose a reason for hiding this comment

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

The context check wants it passed in here, but I did not know the code well enough to add it. @giuseppe PTAL

// 03,1-3 <- this is gonna get parsed as [1,2,3]
// 3,2,1
// 0-2,3,1
//
Copy link
Member

Choose a reason for hiding this comment

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

Extra blank line inserted.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think go fmt is doing this.

Github.com is reporting security issues on older versions of
golang.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan rhatdan merged commit fab09d7 into containers:main Apr 4, 2023
19 checks passed
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

5 participants