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

upload

package
v1.117.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package upload uploads local files to a project and returns the markdown references that embed them in an issue, merge request, or note.

Index

Constants

View Source
const StdinPath = "-"

Variables

This section is empty.

Functions

func Append

func Append(body string, references []string) string

Append returns body with references appended after a blank line.

func Upload

func Upload(ctx context.Context, ios *iostreams.IOStreams, client *gitlab.Client, projectPath string, attachments []Attachment) ([]string, error)

Upload uploads each attachment and returns a markdown reference to each, in order. On failure the error names the ones that did upload, so a retry can reuse them.

Types

type Attachment

type Attachment struct {
	Name string
	Open func() (io.ReadCloser, error)
}

Attachment is a local file to upload and reference from a markdown body.

func Attachments

func Attachments(stdin io.Reader, paths []string) ([]Attachment, error)

Attachments resolves attachment paths, reading stdin for StdinPath. It fails before any upload starts, so a bad path leaves nothing uploaded.

Jump to

Keyboard shortcuts

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