Documentation
¶
Overview ¶
Package utils is used for functions that are used in multiple locations
Index ¶
- Variables
- func GetFileHash(filepath string) (string, error)
- func LogErrorDefaultFormat(packageName, callerName string, err error, action string)
- func LogFatalDefaultFormat(packageName, callerName string, err error, action string)
- func LogPanicDefaultFormat(packageName, callerName string, err error, action string)
- func NewLogger(lvl log.Level) *log.Logger
- type BlogPost
- type Config
- type Deprecated
- type FeatureFlags
- type HiddenArgs
- type Profile
- type ResourceType
- type RessourcesWithSri
Examples ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetFileHash ¶
Example ¶
ExampleGetFileHash provides an example of how to use the function
// Create a temporary file for the example tmpfile, err := os.CreateTemp("", "example") if err != nil { fmt.Printf("Failed to create temp file: %v\n", err) return } defer os.Remove(tmpfile.Name()) // Write some content to the file content := []byte("Hello, World!") if _, err := tmpfile.Write(content); err != nil { fmt.Printf("Failed to write to temp file: %v\n", err) return } tmpfile.Close() // Get the hash _, err = GetFileHash(tmpfile.Name()) if err != nil { fmt.Printf("Failed to get hash: %v\n", err) return } fmt.Println("Hash calculated successfully")
Output: Hash calculated successfully
func LogErrorDefaultFormat ¶
LogErrorDefaultFormat is used to print errors in a uniform way
func LogFatalDefaultFormat ¶
LogFatalDefaultFormat is used to print errors in a uniform way, and exit with a Panic
func LogPanicDefaultFormat ¶
LogPanicDefaultFormat is used to print errors in a uniform way, and exit with a Panic
Types ¶
type BlogPost ¶
type Config ¶
type Config struct { Port int Address string Profile bool TrackingCode string CorsDomain string PullOrigin string FeatureFlags FeatureFlags Deprecated Deprecated Hidden HiddenArgs }
type FeatureFlags ¶
type FeatureFlags []string
func (*FeatureFlags) Contains ¶
func (f *FeatureFlags) Contains(key string) bool
Contains reports wheter a key is contained within the FeatureFlags slice. It returns true if the key is in the slice, else false.
type RessourcesWithSri ¶
type RessourcesWithSri struct { Path string Sri string Type ResourceType }
Source Files
¶
- deprecatedCliHandler.go
- subresourceIntegrity.go
- types.go
- utils.go
Click to show internal directories.
Click to hide internal directories.