gitea-vet/main.go
Andrew Thornton 7c98703580 If you open a session either return it or close it (#16)
If you call `sess := x.NewSession()` you must call `sess.Close()` or return the session.

This is not quite completely perfect for example if you return the output of x.NewSession() immediately it will falsely claim that you're not closing it. However it shows the beginnings of how to do it.

Signed-off-by: Andrew Thornton <art27@cantab.net>

close #15

Reviewed-on: gitea/gitea-vet#16
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-04-13 06:12:04 +08:00

21 lines
389 B
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
import (
"code.gitea.io/gitea-vet/checks"
"golang.org/x/tools/go/analysis/unitchecker"
)
func main() {
unitchecker.Main(
checks.Imports,
checks.License,
checks.Migrations,
checks.ModelsSession,
)
}