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

lint: change vet -shadow to subtest calling -vettool=shadow #36486

Merged
merged 1 commit into from
Apr 3, 2019

Conversation

dt
Copy link
Member

@dt dt commented Apr 3, 2019

-shadow was removed in go 1.12.

Release note: None

@dt dt requested review from bdarnell, nvanbenschoten and a team April 3, 2019 13:34
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@dt
Copy link
Member Author

dt commented Apr 3, 2019

looks like opt and exec both have some shadowing in generated code that we might want to either ignore or fix.

staticcheck also failed for me with some unexpected errors like identical expressions on the left and right side of the '==' operator pointing to lines that didn't have comparisons on them, so I might just need to clean or something, but I suspect that is unrelated to vet change.

Copy link
Contributor

@bdarnell bdarnell left a comment

Choose a reason for hiding this comment

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

LGTM. I assume this version works for both go 1.11 and 1.12?

The "identical expressions" thing is dominikh/go-tools#430

Reviewed 5 of 5 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @nvanbenschoten)

@dt
Copy link
Member Author

dt commented Apr 3, 2019

I checked that build/builder's go had the vettool flag, and it looks like the CI, running 1.11, ran it so I think so.

I need to check with opt and exec about those shadowing errors, then I think this is okay for master / go 1.11 as is, and I'll file a separate issue for the assignment thing.

@dt
Copy link
Member Author

dt commented Apr 3, 2019

I fixed the filtering of shadowing errors from generated code (it has started including line offset in with line number which broke the regex).

Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

:lgtm: thanks!

Reviewed 4 of 5 files at r1, 1 of 1 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @dt)


pkg/testutils/lint/lint_test.go, line 1301 at r2 (raw file):

				stream.GrepNot(`\.[eo]g\.go:[0-9:]+: declaration of ".*" shadows`),
				stream.GrepNot(`^#`), // comment line
				// Upstream compiler error. See: https://github.com/golang/go/issues/23701

Can we get rid of this now that golang/go#23701 is closed?


pkg/testutils/lint/lint_test.go, line 1346 at r2 (raw file):

		}, ",")

		// unfortunately if an analyzer is passed via -vettool like shadow, it seems

Capital "unfortunately"

-shadow was removed in go 1.12.

Release note: None
Copy link
Member Author

@dt dt left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)


pkg/testutils/lint/lint_test.go, line 1301 at r2 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Can we get rid of this now that golang/go#23701 is closed?

Done.


pkg/testutils/lint/lint_test.go, line 1346 at r2 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Capital "unfortunately"

Done.

@dt
Copy link
Member Author

dt commented Apr 3, 2019

bors r+

craig bot pushed a commit that referenced this pull request Apr 3, 2019
36445: storage: avoid double-ingest of same SST on re-apply r=dt a=dt

If an AddSSTable is re-applied when using the no-copy, hard-link only ingest, the second ingest
passes a link to the same underlying file (by inode) to rocks. Due to facebook/rocksdb#5133,
this then causes the ingestion to fail.

This avoids that by checking if the file we're about to ingest already has moore than one link.
If so, we do not allow ingesting the raft file directly and instead make a copy.

Release note: none.

36486: lint: change vet -shadow to subtest calling -vettool=shadow r=dt a=dt

-shadow was removed in go 1.12.

Release note: None

36502: backfill: lower default backfiller batch size to 5000 r=lucy-zhang a=lucy-zhang

Lower `schemachanger.bulk_index_backfill.batch_size` from 5000000 to 5000 to
reduce memory allocation when buffering KVs during index backfills, now that
KVs are buffered and sorted in BulkAdder instead of being sorted in every
batch.

Release note: None

Co-authored-by: David Taylor <[email protected]>
Co-authored-by: Lucy Zhang <[email protected]>
@craig
Copy link
Contributor

craig bot commented Apr 3, 2019

Build succeeded

@craig craig bot merged commit 16ce4f3 into cockroachdb:master Apr 3, 2019
@dt dt deleted the vet branch April 4, 2019 02:10
@dt
Copy link
Member Author

dt commented Apr 4, 2019

@bdarnell should we backport this and #36527 to make linting on release branch also happy on 1.12?

On the one hand, they're test-only changes so I'm not too worried about them.

On the other hand, the CI will stay on go 1.11 thanks to the builder so it'd mostly be for local dev, once people have upgraded to 1.12, but personally, I don't usually run lint on release branches so don't know how important that actually would be. I guess it'd delay the vendor ref diverging, and making dep backports harder, but that seems inevitable so I don't know if that's really a motivating factor.

@bdarnell
Copy link
Contributor

bdarnell commented Apr 4, 2019

I think the frozen builder is good enough for when we're working on older branches, so I wouldn't backport this (but I also wouldn't object to backporting it).

@dt dt mentioned this pull request Apr 4, 2019
5 tasks
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