Help us shape the future of Go! Take the 2026 Go Developer Survey

util

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package util contains general helper functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Difference

func Difference(list []string, set map[string]struct{}) []string

Difference returns the elements in list that are not in set.

func DownloadImageData

func DownloadImageData(url string) (string, []byte, error)

downloadImageData downloads the content from the given URL and returns the image type and data. The image type is the second part of the response's MIME (e.g. "png" from "image/png").

func Intersection

func Intersection(list []string, set map[string]struct{}) []string

Intersection returns the elements in list that are in set.

func ListKeys

func ListKeys[T any](m map[string]T) []string

func MinInt

func MinInt(nums []int) int

MinInt returns the minimum value in nums. If nums is empty, it returns 0.

func ToSet

func ToSet(list []string) map[string]struct{}

ToSet converts a list to a set.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL