[disk][host]: change to use type alias.

This commit is contained in:
shirou 2022-11-30 23:17:41 +00:00
parent 4ac7e99c6a
commit 5473fd114d
4 changed files with 5 additions and 31 deletions

View File

@ -15,6 +15,8 @@ import (
"golang.org/x/sys/windows/registry" "golang.org/x/sys/windows/registry"
) )
type Warnings = common.Warnings
var ( var (
procGetDiskFreeSpaceExW = common.Modkernel32.NewProc("GetDiskFreeSpaceExW") procGetDiskFreeSpaceExW = common.Modkernel32.NewProc("GetDiskFreeSpaceExW")
procGetLogicalDriveStringsW = common.Modkernel32.NewProc("GetLogicalDriveStringsW") procGetLogicalDriveStringsW = common.Modkernel32.NewProc("GetLogicalDriveStringsW")

View File

@ -19,6 +19,8 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
type Warnings = common.Warnings
type lsbStruct struct { type lsbStruct struct {
ID string ID string
Release string Release string

View File

@ -1,30 +0,0 @@
package host
import "fmt"
type Warnings struct {
List []error
Verbose bool
}
func (w *Warnings) Add(err error) {
w.List = append(w.List, err)
}
func (w *Warnings) Reference() error {
if len(w.List) > 0 {
return w
}
return nil
}
func (w *Warnings) Error() string {
if w.Verbose {
str := ""
for i, e := range w.List {
str += fmt.Sprintf("\tError %d: %s\n", i, e.Error())
}
return str
}
return fmt.Sprintf("Number of warnings: %v", len(w.List))
}

View File

@ -1,4 +1,4 @@
package disk package common
import "fmt" import "fmt"