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

cmd/vet: eliminate use of Perl in tests #20032

Closed
josharian opened this issue Apr 18, 2017 · 23 comments
Closed

cmd/vet: eliminate use of Perl in tests #20032

josharian opened this issue Apr 18, 2017 · 23 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@josharian
Copy link
Contributor

See #20007 and discussion at CL 40950.

@josharian josharian added this to the Unplanned milestone Apr 18, 2017
@bradfitz
Copy link
Contributor

Note that test/run.go has a Go port of errchk already.

func (t *test) errorCheck(outStr string, wantAuto bool, fullshort ...string) (err error) {}
func (t *test) wantedErrors(file, short string) (errs []wantedError) {}

@bradfitz bradfitz added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Apr 18, 2017
@niconegoto
Copy link
Contributor

@bradfitz I will work on this.

@SCKelemen
Copy link
Contributor

@niconegoto Are you still working on this?

@niconegoto
Copy link
Contributor

@SCKelemen Sorry.I don't have time to work on this now.

@grepory
Copy link
Contributor

grepory commented Jul 15, 2017

If we moved a Go rewrite of errchk into its own package under test/errorcheck/ and made it buildable, we could both continue to use the errorcheck package directly from test/run.go and compile test/errorcheck/cmd into test/errchk for use in vet's tests. Does this seem reasonable?

I think we cannot move this under src/ somewhere, because test/run.go is run with the bootstrap go, right? So it's using not this stdlib? I'm still fuzzy on the build process.

@bradfitz or @niconegoto

@grepory
Copy link
Contributor

grepory commented Jul 15, 2017

I'd prefer a solution that's just calling methods/funcs in both places, but I'm not sure if that's actually possible.

EDIT:

I should also say that this would feel weird to me in stdlib.

@ALTree
Copy link
Member

ALTree commented Aug 7, 2017

@grepory Putting errchk in the stdlib just to ease the testing process of vet is definitely a no-no IMHO. If everything else fails and/or we don't find a simple way to avoid duplication, I'd say last resort would be to just copy the two go functions we already ported in the vet_test file and use them from there.

@grepory
Copy link
Contributor

grepory commented Aug 7, 2017

errcheck is used in more than vet test, iirc. I couldn't figure out a way to do it that didn't involve duplication, so I just decided to drop it for now. And yeah, I agree with you about errcheck in stdlib.

@ALTree
Copy link
Member

ALTree commented Aug 7, 2017

errcheck is used in more than vet test, iirc

A silly recursive grep in src/ for errchk (the name of the perl file) only shows results in ./cmd/vet/vet_test.go, but maybe I missed some uses.

@grepory
Copy link
Contributor

grepory commented Aug 7, 2017

Probably not. I think I was conflating this with another issue I read which was "remove use of perl in build process" -- which is something to which we should all aspire.

@SCKelemen
Copy link
Contributor

I can work on this, if there is a decision on what to do.

@ianlancetaylor
Copy link
Contributor

@SCKelemen Thanks. We should simply copy the errchk functionality, rewritten into Go, into cmd/vet. You can probably start with the functions @bradfitz mentioned in test/run.go. We should not create a new package for this. We will almost certainly want to adapt the Go code for the specific tool needs over time.

@SCKelemen
Copy link
Contributor

Okay, I'll work on this.

@ghost
Copy link

ghost commented Nov 9, 2017

I wrote to Perl 5 Porters, here are the responses.

Shlomi Fish

Well, escaped left braces in regexes ("\{") should work fine in older versions of perl, so there is no good reason to avoid escaping them.

Jim Keenan

No matter what language you use, and no matter whether that's for ordinary code or for a project's test suite, that language is going to evolve over time. No language is 100% backwards-compatible for all time. That implies that periodically you may have to update your code to account for such issues.

Now, other things being equal, if the code in question is the core distribution of a computer language, you have more control if the core's test suite is written in that language itself. At the very least, you're likely to find out very quickly if changes in the language break the test suite. Indeed, when #20007 emerged earlier this year, I was surprised to learn that part of the golang test suite was written in Perl.

That being said, as Shlomi has already pointed out, the actual breakage in the golang test suite was small and easily fixed to work in both perl-5.26 and earlier versions.

@awoodbeck
Copy link
Contributor

@SCKelemen do you still have this issue?

@SCKelemen
Copy link
Contributor

@awoodbeck This has fallen off of my radar. My apologies. If you want to work on this, go for it. If not, I can try to work on this during the weekend.

@ysmolski
Copy link
Member

FYI, I will try to handle it.

@ghost
Copy link

ghost commented May 22, 2018

@ysmolsky

FYI, I will try to handle it.

Upgrading go/test/errchk for >= perl-5.26 or eliminating the use of Perl?

@ysmolski
Copy link
Member

Eliminating the use of perl. Prototype was done, going to polish some edges and submit CL...

@gopherbot
Copy link

Change https://golang.org/cl/114176 mentions this issue: cmd/vet: eliminate use of Perl in tests

@ghost
Copy link

ghost commented May 22, 2018

@ysmolsky

https://code.9front.org/hg/plan9front/file/8e57f29e99a3/sys/lib/kbmap/by

There is a golang port to Plan 9, and not per se golang related, but if the opportunity arises and someday you might check the by kbmap for accuracy, which I modified from a Plan 9 ru kbmap file, and submitted to 9front on 05 May 2016, though I never had tested the file, it would be appreciated.

https://code.9front.org/hg/plan9front/file/2241e3dd1a2c/sys/lib/kbmap/by

22 May 2018 change

@ysmolski ysmolski modified the milestones: Unplanned, Go1.11 May 23, 2018
@ysmolski
Copy link
Member

Slightly related, should we try to eliminate errchk completely from Go tree?

I see that there are two tests use it:
https://github.com/golang/go/blob/master/test/fixedbugs/bug248.go
https://github.com/golang/go/blob/master/test/fixedbugs/bug345.go

Just by looking at them, I do not see easy way out since we cannot use errorCheck from test/run.go.

Any ideas?

@ianlancetaylor
Copy link
Contributor

I think we can do it by adding a couple more actions to test/run.go. errchklinkdir and errchkcompile or something like that.

@golang golang locked and limited conversation to collaborators May 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

10 participants