• v1.0.0 3d12d18200

    Rene Nochebuena released this 2026-05-19 21:45:04 -06:00 | 0 commits to main since this release

    v1.0.0

    code.nochebuena.dev/go/minio

    Overview

    minio v1.0.0 commits the MinIO client lifecycle API as stable. The module manages the
    lifecycle of a minio-go SDK client: constructs it from config, verifies that the configured
    bucket exists at startup (creating it if absent), exposes a Client interface with the most
    common object operations, maps minio-go errors to portable xerrors codes, and provides a
    health check via BucketExists.

    Full API (stable)

    Config — embeddable struct with env tags:

    Field Env var Required Default Notes
    Endpoint MINIO_ENDPOINT Yes Host and port, e.g. minio:9000
    AccessKey MINIO_ACCESS_KEY Yes
    SecretKey MINIO_SECRET_KEY Yes
    Bucket MINIO_BUCKET Yes Created at startup if it does not exist
    UseSSL MINIO_USE_SSL No false
    Region MINIO_REGION No us-east-1 Bypasses per-request region detection
    Transport (env:"-") No nil For test injection only

    Client — inject into repositories for direct object operations:

    type Client interface {
        PutObject(ctx, bucket, key string, reader io.Reader, size int64, opts miniogo.PutObjectOptions) (miniogo.UploadInfo, error)
        GetObject(ctx, bucket, key string, opts miniogo.GetObjectOptions) (*miniogo.Object, error)
        RemoveObject(ctx, bucket, key string, opts miniogo.RemoveObjectOptions) error
        PresignedGetObject(ctx, bucket, key string, expires time.Duration, reqParams url.Values) (*url.URL, error)
        HandleError(err error) error
    }
    

    All methods return errors already mapped to xerrors typed values. When using Native()
    directly, call HandleError before returning errors to callers.

    Component — embeds launcher.Component, health.Checkable, Client, and Native();
    register with lc.Append.

    New(logger logz.Logger, cfg Config) Component — constructor; SDK client created in OnInit.

    HandleError(err error) error — package-level function and Client method; maps minio-go
    ErrorResponse codes to xerrors:

    minio-go code xerrors code
    NoSuchBucket ErrNotFound
    NoSuchKey ErrNotFound
    AccessDenied, InvalidAccessKeyId ErrPermissionDenied
    BucketAlreadyExists, BucketAlreadyOwnedByYou ErrAlreadyExists
    anything else ErrInternal

    HealthCheck(ctx) error — calls BucketExists; priority health.LevelCritical.

    Lifecycle

    Hook Behaviour
    OnInit Constructs the minio-go SDK client; no network call
    OnStart Checks whether the configured bucket exists; creates it if not
    OnStop Sets internal client to nil; minio-go is stateless

    Usage

    go get code.nochebuena.dev/go/minio@v1.0.0
    
    Downloads