Merge pull request #81721 from mattjmcnaughton/mattjmcnaughton/close-open-files-in-conformance

Close leaking files in `conformance/walk.go`
This commit is contained in:
Kubernetes Prow Robot 2019-08-23 00:51:45 -07:00 committed by GitHub
commit 56aded4db0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,6 +180,7 @@ func (v *visitor) comment(x *ast.BasicLit) string {
//proximity of the comment and apply it.
myf, err := os.Open(v.FileSet.File(x.Pos()).Name())
if err == nil {
defer myf.Close()
if _, err := myf.Seek(int64(comm.End()), 0); err == nil {
if _, err := myf.Read(b1); err == nil {
if strings.Compare(strings.Trim(string(b1), "\t \r\n"), "framework.ConformanceIt(\"") == 0 {