Linting fixes + FileManager share start refactor

This commit is contained in:
AlexSSD7 2023-09-02 12:07:30 +01:00
commit b15e2df3d3
11 changed files with 66 additions and 120 deletions

View file

@ -7,12 +7,12 @@ import (
"github.com/shirou/gopsutil/process"
)
type NetTapAlloc struct {
type Alloc struct {
TapName string
PID int
}
func (a *NetTapAlloc) Validate() error {
func (a *Alloc) Validate() error {
err := ValidateTapName(a.TapName)
if err != nil {
return errors.Wrap(err, "validate tap name")
@ -22,7 +22,7 @@ func (a *NetTapAlloc) Validate() error {
return fmt.Errorf("pid is zero")
}
if a.PID > int(a.PID) {
if a.PID > int(int32(a.PID)) {
return fmt.Errorf("pid int32 overflow (%v)", a.PID)
}
@ -31,7 +31,7 @@ func (a *NetTapAlloc) Validate() error {
// The taps removed slice always returns the taps removed, even after
// an error has occurred sometime while deleting non-first interfaces.
func (tm *TapManager) PruneTaps(knownAllocs []NetTapAlloc) ([]string, error) {
func (tm *TapManager) PruneTaps(knownAllocs []Alloc) ([]string, error) {
var tapsRemoved []string
for i, alloc := range knownAllocs {