// Copyright (c) 2024-2026 Celestino Amoroso (celestino.amoroso@gmail.com). // All rights reserved. // file.go package file import ( "os" "git.portale-stac.it/go-pkg/expr/kern" ) type Handle interface { kern.Typer GetFile() *os.File GetName() string Valid() bool Close() error } type handleBase struct { fh *os.File } func (h *handleBase) GetFile() *os.File { return h.fh } func (h *handleBase) GetName() (name string) { if h.fh != nil { name = h.fh.Name() } return } func (h *handleBase) Valid() bool { return h.fh != nil } func (h *handleBase) Close() (err error) { if h.fh != nil { err = h.fh.Close() h.fh = nil } return }