forgepb

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: GPL-3.0 Imports: 23 Imported by: 26

README

protobuf definition files for forge

Documentation

Overview

Example

This example is copied from rill to understand golang docs

package main

import (
	"fmt"
)

func main() {
	fmt.Println("nothing here yet")
}
Output:

Example (Batching)

This example is copied from rill to understand golang docs

package main

import (
	"fmt"
)

func main() {
	fmt.Println("nothing batching here yet")
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var FORGEPB *log.LogFlag
View Source
var FORGEPBWARN *log.LogFlag
View Source
var File_forgeConfig_proto protoreflect.FileDescriptor

Functions

func FindGoSrc added in v0.0.5

func FindGoSrc() (string, error)

look for a go.work file otherwise use ~/go/src

func IsGitDir added in v0.0.7

func IsGitDir(dir string) bool

IsGitDir checks if a .git directory exists inside the given directory

Types

type Forge added in v0.0.7

type Forge struct {
	Config  *ForgeConfigs // config repos for readonly, private, etc
	Repos   *gitpb.Repos
	Machine *zoopb.Machine
	// contains filtered or unexported fields
}

maybe an interface someday?

func Init added in v0.0.7

func Init() *Forge

func (*Forge) ConfigPrintTable added in v0.0.7

func (f *Forge) ConfigPrintTable()

print a human readable table to STDOUT

func (*Forge) ConfigSave added in v0.0.7

func (f *Forge) ConfigSave() error

write to ~/.config/forge/ unless ENV{FORGE_HOME} is set

func (*Forge) DebName added in v0.0.7

func (f *Forge) DebName(gopath string) string

returns the deb package name this let's you check a git tag version against a package .deb version allows gopath's to not need to match the .deb name this is important in lots of cases! It is normal and happens often enough.

func (*Forge) GetGoSrc added in v0.0.7

func (f *Forge) GetGoSrc() string

func (*Forge) IsFavorite added in v0.0.7

func (f *Forge) IsFavorite(thing string) bool

IsFavorite() -- fun option for the config file that lets you set things as favorites so you can just go-clone a bunch of common things on a new box or after you reset/delete your ~/go/src dir

func (*Forge) IsPrivate added in v0.0.7

func (f *Forge) IsPrivate(thing string) bool

is this a non-publishable repo? matches package names from apt

IsPrivate("foo") will match anything in the config file ending in "foo"

IsPrivate("go.foo.com/jcarr/foo") returns true if private IsPrivate("foo") also returns true if "go.bar.com/jcarr/foo" is private

func (*Forge) IsReadOnly added in v0.0.7

func (f *Forge) IsReadOnly(gopath string) bool

returns true if gopath is readonly() will attempt to match IsWritable("foo") against anything ending in "foo"

func (*Forge) ScanGoSrc added in v0.0.7

func (f *Forge) ScanGoSrc() (bool, error)

func (*Forge) SortByPath added in v0.0.7

func (f *Forge) SortByPath() *ForgeConfigIterator

type ForgeConfig added in v0.0.7

type ForgeConfig struct {
	GoPath           string                 `protobuf:"bytes,1,opt,name=goPath,proto3" json:"goPath,omitempty"`                     // Examples: 'go.wit.com/apps/go-clone' or "~/mythings" or "/home/src/foo"
	Writable         bool                   `protobuf:"varint,2,opt,name=writable,proto3" json:"writable,omitempty"`                // if you have write access to the repo
	ReadOnly         bool                   `protobuf:"varint,3,opt,name=readOnly,proto3" json:"readOnly,omitempty"`                // the opposite, but needed for now because I don't know what I'm doing
	Private          bool                   `protobuf:"varint,4,opt,name=private,proto3" json:"private,omitempty"`                  // if the repo can be published
	Directory        bool                   `protobuf:"varint,5,opt,name=directory,proto3" json:"directory,omitempty"`              // everything in this directory should use these writable & private values
	Favorite         bool                   `protobuf:"varint,6,opt,name=favorite,proto3" json:"favorite,omitempty"`                // you like this. always git clone/go clone this repo
	Interesting      bool                   `protobuf:"varint,7,opt,name=interesting,proto3" json:"interesting,omitempty"`          // this is something interesting you found and want to remember it
	MasterBranchName string                 `protobuf:"bytes,8,opt,name=masterBranchName,proto3" json:"masterBranchName,omitempty"` // git 'main' or 'master' branch name
	DevelBranchName  string                 `protobuf:"bytes,9,opt,name=develBranchName,proto3" json:"develBranchName,omitempty"`   // whatever the git 'devel' branch name is
	UserBranchName   string                 `protobuf:"bytes,10,opt,name=userBranchName,proto3" json:"userBranchName,omitempty"`    // whatever your username branch is
	DebName          string                 `protobuf:"bytes,11,opt,name=debName,proto3" json:"debName,omitempty"`                  // the actual name used with 'apt install' (or distro apt equivalent.
	Verstamp         *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=verstamp,proto3" json:"verstamp,omitempty"`                // the git commit timestamp of the version
	// contains filtered or unexported fields
}

define 3 branches. that is all that is supported the term 'master' is used in the code because 'main' is a reserved word in golang already allow 'read only' and 'private' flags package names sometimes must be different than the binary name for example 'zookeeper' is packaged as 'zookeeper-go'

due to the prior apache foundation project. This happens and is ok!

func (*ForgeConfig) Descriptor deprecated added in v0.0.7

func (*ForgeConfig) Descriptor() ([]byte, []int)

Deprecated: Use ForgeConfig.ProtoReflect.Descriptor instead.

func (*ForgeConfig) GetDebName added in v0.0.7

func (x *ForgeConfig) GetDebName() string

func (*ForgeConfig) GetDevelBranchName added in v0.0.7

func (x *ForgeConfig) GetDevelBranchName() string

func (*ForgeConfig) GetDirectory added in v0.0.7

func (x *ForgeConfig) GetDirectory() bool

func (*ForgeConfig) GetFavorite added in v0.0.7

func (x *ForgeConfig) GetFavorite() bool

func (*ForgeConfig) GetGoPath added in v0.0.7

func (x *ForgeConfig) GetGoPath() string

func (*ForgeConfig) GetInteresting added in v0.0.7

func (x *ForgeConfig) GetInteresting() bool

func (*ForgeConfig) GetMasterBranchName added in v0.0.7

func (x *ForgeConfig) GetMasterBranchName() string

func (*ForgeConfig) GetPrivate added in v0.0.7

func (x *ForgeConfig) GetPrivate() bool

func (*ForgeConfig) GetReadOnly added in v0.0.7

func (x *ForgeConfig) GetReadOnly() bool

func (*ForgeConfig) GetUserBranchName added in v0.0.7

func (x *ForgeConfig) GetUserBranchName() string

func (*ForgeConfig) GetVerstamp added in v0.0.7

func (x *ForgeConfig) GetVerstamp() *timestamppb.Timestamp

func (*ForgeConfig) GetWritable added in v0.0.7

func (x *ForgeConfig) GetWritable() bool

func (*ForgeConfig) ProtoMessage added in v0.0.7

func (*ForgeConfig) ProtoMessage()

func (*ForgeConfig) ProtoReflect added in v0.0.7

func (x *ForgeConfig) ProtoReflect() protoreflect.Message

func (*ForgeConfig) Reset added in v0.0.7

func (x *ForgeConfig) Reset()

func (*ForgeConfig) String added in v0.0.7

func (x *ForgeConfig) String() string

type ForgeConfigByPath added in v0.0.7

type ForgeConfigByPath []*ForgeConfig

func (ForgeConfigByPath) Len added in v0.0.7

func (a ForgeConfigByPath) Len() int

func (ForgeConfigByPath) Less added in v0.0.7

func (a ForgeConfigByPath) Less(i, j int) bool

func (ForgeConfigByPath) Swap added in v0.0.7

func (a ForgeConfigByPath) Swap(i, j int)

type ForgeConfigIterator added in v0.0.7

type ForgeConfigIterator struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewForgeConfigIterator added in v0.0.7

func NewForgeConfigIterator(packs []*ForgeConfig) *ForgeConfigIterator

NewForgeConfigIterator initializes a new iterator.

func (*ForgeConfigIterator) Next added in v0.0.7

func (it *ForgeConfigIterator) Next() *ForgeConfig

Next() returns the next thing in the array

func (*ForgeConfigIterator) Scan added in v0.0.7

func (it *ForgeConfigIterator) Scan() bool

Scan moves to the next element and returns false if there are no more packs. Use Scan() in a loop, similar to a while loop

for iterator.Scan()
	d := iterator.Next(
	fmt.Println("found UUID:", d.Uuid
}

type ForgeConfigs added in v0.0.7

type ForgeConfigs struct {
	sync.RWMutex // auto-added by go.wit.com/apps/autogenpb

	Uuid         string         `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`       // could be useful for /usr/share/file/magic someday?
	Version      string         `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // could be used for protobuf schema change violations?
	ForgeConfigs []*ForgeConfig `protobuf:"bytes,3,rep,name=ForgeConfigs,proto3" json:"ForgeConfigs,omitempty"`
	// contains filtered or unexported fields
}

TODO: autogen 'sort', 'marshal'

func (*ForgeConfigs) All added in v0.0.7

func (all *ForgeConfigs) All() *ForgeConfigIterator

func (*ForgeConfigs) Append added in v0.0.7

func (all *ForgeConfigs) Append(newP *ForgeConfig) bool

does not enforce any unique fields

func (*ForgeConfigs) AppendUniqueGoPath added in v0.0.7

func (all *ForgeConfigs) AppendUniqueGoPath(newP *ForgeConfig) bool

enforces GoPath is unique

func (*ForgeConfigs) ConfigLoad added in v0.0.7

func (c *ForgeConfigs) ConfigLoad() error

load the ~/.config/forge/ files

func (*ForgeConfigs) DeleteByGoPath added in v0.0.7

func (all *ForgeConfigs) DeleteByGoPath(s string) *ForgeConfig

func (*ForgeConfigs) Descriptor deprecated added in v0.0.7

func (*ForgeConfigs) Descriptor() ([]byte, []int)

Deprecated: Use ForgeConfigs.ProtoReflect.Descriptor instead.

func (*ForgeConfigs) FindByGoPath added in v0.0.7

func (all *ForgeConfigs) FindByGoPath(s string) *ForgeConfig

find a dependancy by the go path

func (*ForgeConfigs) FormatJSON added in v0.0.7

func (v *ForgeConfigs) FormatJSON() string

human readable JSON

func (*ForgeConfigs) FormatTEXT added in v0.0.7

func (v *ForgeConfigs) FormatTEXT() string

apparently this isn't stable, but it's awesomely better https://protobuf.dev/reference/go/faq/#unstable-text it's so great for config files, I'm using it by default to try to fix the problems with it

func (*ForgeConfigs) GetForgeConfigs added in v0.0.7

func (x *ForgeConfigs) GetForgeConfigs() []*ForgeConfig

func (*ForgeConfigs) GetUuid added in v0.0.7

func (x *ForgeConfigs) GetUuid() string

func (*ForgeConfigs) GetVersion added in v0.0.7

func (x *ForgeConfigs) GetVersion() string

func (*ForgeConfigs) Len added in v0.0.7

func (all *ForgeConfigs) Len() int

func (*ForgeConfigs) Marshal added in v0.0.7

func (v *ForgeConfigs) Marshal() ([]byte, error)

marshal to wire. This is called winning.

func (*ForgeConfigs) MarshalJSON added in v0.0.7

func (v *ForgeConfigs) MarshalJSON() ([]byte, error)

marshal json

func (*ForgeConfigs) ProtoMessage added in v0.0.7

func (*ForgeConfigs) ProtoMessage()

func (*ForgeConfigs) ProtoReflect added in v0.0.7

func (x *ForgeConfigs) ProtoReflect() protoreflect.Message

func (*ForgeConfigs) ReplaceGoPath added in v0.0.7

func (all *ForgeConfigs) ReplaceGoPath(newP *ForgeConfig) bool

enforces GoPath is unique

func (*ForgeConfigs) Reset added in v0.0.7

func (x *ForgeConfigs) Reset()

func (*ForgeConfigs) SampleConfig added in v0.0.7

func (all *ForgeConfigs) SampleConfig()

func (*ForgeConfigs) SortByPath added in v0.0.7

func (all *ForgeConfigs) SortByPath() *ForgeConfigIterator

func (*ForgeConfigs) String added in v0.0.7

func (x *ForgeConfigs) String() string

func (*ForgeConfigs) Unmarshal added in v0.0.7

func (v *ForgeConfigs) Unmarshal(data []byte) error

unmarshal from wire. You have won.

func (*ForgeConfigs) UnmarshalJSON added in v0.0.7

func (v *ForgeConfigs) UnmarshalJSON(data []byte) error

unmarshal json

func (*ForgeConfigs) UnmarshalTEXT added in v0.0.7

func (v *ForgeConfigs) UnmarshalTEXT(data []byte) error

unmarshalTEXT. This reads the .text config file back in after the user edits it

func (*ForgeConfigs) UpdateGoPath added in v0.0.7

func (all *ForgeConfigs) UpdateGoPath(name string, gopath string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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