mirror of
https://github.com/nabbar/golib.git
synced 2025-09-26 20:01:15 +08:00

- Add some README file to give missing documentations or update existing documentation file Package Archive: - Add some comments to godoc information - Moving NopWriterCloser interface to ioutils package Package IOUtils: - New package NopWriterCloser to implement interfac like NopReader Package Database: - KVMap: fix missing function following update of kvdriver Package Duration: - Rename BDD testing Package Context/Gin: - Moving function New between model & interface file Package AWS: - rework Walk function to use more generic with standard walk caller function - func walk will now no more return and include error (can be catched into the given func) - func walk will now return a bool to continue or stop the loop - func walk with many input function will now stop when all given function return false - func walk will now return error only about main process and not given function Package errors: - Add interface error into interface Error Package IOUtils: - Moving IOWrapper as subPackage and optimize process + allow thread safe
1.8 KiB
1.8 KiB
Golib Artifact
Golang utilities for artifact version management retrieve / download
Overview
The artifact
package provides tools to list, search, retrieve or downlaod version of artifacts such as files, binaries...
Installation
Add the dependency to your Go project:
go get github.com/nabbar/golib/artifact
Or in your go.mod
:
require github.com/nabbar/golib/artifact vX.Y.Z
Features
- List and search artifacts
- Retrieve artifacts by name and version
- Retrieve minor / major versions of artifacts
- Retrieve latest version of artifacts
- Retrieve download URL of artifacts
- Support for local and remote storage backends
Quick Start
package main
import (
"context"
"fmt"
"net/http"
"os"
"github.com/nabbar/golib/artifact"
"github.com/hashicorp/go-version"
"github.com/nabbar/golib/artifact/github"
)
func main() {
var (
err error
art artifact.Client
lst version.Collection
)
// Create a new artifact manager
art, err = github.NewGithub(context.Background(), &http.Client{}, "repo")
if err != nil {
fmt.Println("Error creating artifact manager:", err)
return
}
// List Versions
lst, err = art.ListReleases()
if err != nil {
fmt.Println("Error retrieving artifact:", err)
return
}
for _, ver := range lst {
fmt.Printf("Version: %s\n", ver.String())
link, e := art.GetArtifact("linux", "", ver)
if e != nil {
fmt.Println("No linux version found")
continue
}
fmt.Printf("Donwload Linux: %s\n", link)
}
}
Error Handling
All functions return an error
value. Always check and handle errors when storing, retrieving, or verifying artifacts.
Contributing
Contributions are welcome! Please submit issues or pull requests on GitHub.
License
MIT © Nicolas JUHEL