Package forgejo provides tools for working with Forgejo servers (such as Codeberg), for the Go programming language.
Find a file
2025-10-07 16:44:58 -07:00
internal fsdir.DirReaderAll 2025-10-07 16:44:58 -07:00
dirfs.go DirReaderAll 2025-10-03 20:21:19 -07:00
dirreaderall.go DirReaderAll 2025-10-03 20:21:19 -07:00
errors.go
fs.go forgejo.FS 2025-10-05 23:39:07 -07:00
go.mod fsdir.DirReaderAll 2025-10-07 16:44:58 -07:00
go.sum fsdir.DirReaderAll 2025-10-07 16:44:58 -07:00
LICENSE
open.go logging 2025-10-05 00:33:26 -07:00
README.md docs 2025-10-02 07:01:06 -07:00

go-forgejo

Package forgejo provides tools for working with Forgejo servers (such as Codeberg), for the Go programming language.

Package forgejo provides a "io/fs" interface for all the Forgejo servers on the Internet. Enabling you to open files on a Forgejo as an fs.File. And, enabling you to open directories on a Forgejo server as an fs.FS.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-forgejo

GoDoc

Example

Here is an example of opening up a file for reading. Here we are connecting to the popular codeberg.org Forgejo server, and opening the file named README.md in the repo named bing-bong-bang under the account for the user named joeblow:

import "codeberg.org/reiver/go-forgejo"

file, err := forgejo.Open("codeberg.org/joeblow/bing-bong-bang/docs/HACKING.md")

Here is an example of opening up a directory as a file-system:

import "codeberg.org/reiver/go-forgejo"

filesys, err := forgejo.DirFS("codeberg.org/joeblow/bing-bong-bang/docs")

Here is an example of casting an fs.File to a fs.FS when the fs.File represents a directory:

import "codeberg.org/reiver/go-forgejo"

file, err := forgejo.Open("codeberg.org/joeblow/bing-bong-bang/docs")
if nil != err {
	return err
}

switch file.(type) {
case fs.FS:
	// It is actually a directory.
default:
	// It is just a file.
}

Import

To import package forgejo use import code like the following:

import "codeberg.org/reiver/go-forgejo"

Installation

To install package forgejo do the following:

GOPROXY=direct go get codeberg.org/reiver/go-forgejo

Author

Package forgejo was written by Charles Iliya Krempeaux