Skip to content

Updating minimum Go version to 1.19 #3304

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

Merged
merged 5 commits into from
Jun 16, 2023
Merged

Updating minimum Go version to 1.19 #3304

merged 5 commits into from
Jun 16, 2023

Conversation

iwankgb
Copy link
Collaborator

@iwankgb iwankgb commented May 8, 2023

Reasoning behind this proposal:

  • Kubernetes requires 1.20 on main anyway
  • We run tests on 1.19 and 1.20 only
  • Versions in / and /cmd shall be the same.

Note for the reviewers: take a look at utils.sysfs.toFileInfo() - this the only addition/change that was not performed using replace functionality in my IDE.

@iwankgb iwankgb force-pushed the go-1.19 branch 3 times, most recently from d6277f9 to 6078378 Compare May 8, 2023 13:31
@iwankgb iwankgb force-pushed the go-1.19 branch 3 times, most recently from bc2f0ba to f4c2421 Compare May 8, 2023 14:52
Comment on lines 41 to 40
testDir, err := ioutil.TempDir("", "")
testDir, err := os.MkdirTemp(os.TempDir(), "")
Copy link
Contributor

Choose a reason for hiding this comment

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

it's better to use t.TemDir() here.

fs/fs_test.go Outdated
@@ -119,14 +118,14 @@ func TestDirDiskUsage(t *testing.T) {
as := assert.New(t)
fsInfo, err := NewFsInfo(Context{})
as.NoError(err)
dir, err := ioutil.TempDir(os.TempDir(), "")
dir, err := os.MkdirTemp(os.TempDir(), "")
Copy link
Contributor

Choose a reason for hiding this comment

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

better to use t.TempDir() here.

@@ -279,7 +290,23 @@ func (fs *realSysFs) GetNetworkStatValue(dev string, stat string) (uint64, error

func (fs *realSysFs) GetCaches(id int) ([]os.FileInfo, error) {
cpuPath := fmt.Sprintf("%s%d/cache", cacheDir, id)
return ioutil.ReadDir(cpuPath)
dir, err := os.ReadDir(cpuPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is an incompatible change, but it would make sense to convert this to return []os.DirEntry instead.

Otherwise, practically, what happens here, is a stat(2) call to every entry, which is kinda expensive. More to say, it seems the only user of this function is in utils/sysinfo (I checked), so while this is a public API, apparently it has no users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are three other uses of toFileInfo() that would have to be fixed. While I understand you concern and I believe that it's valid, I'm hesitant to do this as part of this PR and I would prefer to address it in future.

@iwankgb
Copy link
Collaborator Author

iwankgb commented Jun 8, 2023

/assign @bobbypage

Copy link
Collaborator

@Creatone Creatone left a comment

Choose a reason for hiding this comment

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

LGTM

Will you handle the @kolyshkin proposal on the t.TempDir?

@iwankgb
Copy link
Collaborator Author

iwankgb commented Jun 15, 2023

I did in 814bb27

@Creatone
Copy link
Collaborator

I did in 814bb27

I miss that, sorry

@Creatone Creatone merged commit 5a0fe19 into google:master Jun 16, 2023
@bobbypage
Copy link
Collaborator

delayed lgtm, thank you for the fixes!

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.

4 participants