mirror of
https://github.com/gotify/server.git
synced 2026-05-08 14:26:56 +08:00
* chore(deps): update bump go dependencies * Update golangci-lint Signed-off-by: eternal-flame-AD <yume@yumechi.jp> * Update golangci config to reflect new format Signed-off-by: eternal-flame-AD <yume@yumechi.jp> * remove deprecated ioutil package Signed-off-by: eternal-flame-AD <yume@yumechi.jp> --------- Signed-off-by: eternal-flame-AD <yume@yumechi.jp> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: eternal-flame-AD <yume@yumechi.jp>
28 lines
552 B
Go
28 lines
552 B
Go
package test
|
|
|
|
import (
|
|
"os"
|
|
"path"
|
|
)
|
|
|
|
// TmpDir is a handler to temporary directory.
|
|
type TmpDir struct {
|
|
path string
|
|
}
|
|
|
|
// Path returns the path to the temporary directory joined by the elements provided.
|
|
func (c TmpDir) Path(elem ...string) string {
|
|
return path.Join(append([]string{c.path}, elem...)...)
|
|
}
|
|
|
|
// Clean removes the TmpDir.
|
|
func (c TmpDir) Clean() error {
|
|
return os.RemoveAll(c.path)
|
|
}
|
|
|
|
// NewTmpDir returns a new handle to a tmp dir.
|
|
func NewTmpDir(prefix string) TmpDir {
|
|
dir, _ := os.MkdirTemp("", prefix)
|
|
return TmpDir{dir}
|
|
}
|