Skip to content

Commit 629f197

Browse files
committed
Improve docs
1 parent 03c902f commit 629f197

File tree

7 files changed

+21
-9
lines changed

7 files changed

+21
-9
lines changed

cmd/dot/root.go

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func init() {
6666
rootCmd.AddCommand(versionCmd)
6767
}
6868

69+
// Execute runs the root command for dot.
6970
func Execute() {
7071
if err := rootCmd.Execute(); err != nil {
7172
log.Fatal(err)

main.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Dot is a local first CI system.
2+
//
3+
// Dot uses Docker to run jobs concurrently in stages. More info can be found at https://github.com/opnlabs/dot/wiki
14
package main
25

36
import (

pkg/models/models.go

+5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package models
22

33
type Stage string
4+
5+
// Variable represents a job variable as a key-value pair.
6+
// Variables are defined as an array of key-value pairs, so each Variable map only has 1 entry.
47
type Variable map[string]any
58

9+
// JobFile represents the dot.yml file
610
type JobFile struct {
711
Stages []Stage `yaml:"stages" validate:"required,dive"`
812
Jobs []Job `yaml:"jobs" validate:"required,dive"`
913
}
1014

15+
// Job represents a single job in a stage
1116
type Job struct {
1217
Name string `yaml:"name" validate:"required"`
1318
Src string `yaml:"src"`

pkg/runner/docker.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Package runner implements the backend that executes the jobs.
2+
//
3+
// Docker runner uses the docker runtime to execute jobs.
14
package runner
25

36
import (

pkg/store/memorystore.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package store implements a simple key-value store.
12
package store
23

34
import (

pkg/utils/compress.go

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Package utils provides some utility functions to compress and decompress tar and tar.gz.
2+
// It also provides a logger that can output in color and implements io.Writer.
13
package utils
24

35
import (
@@ -13,8 +15,7 @@ import (
1315

1416
const MaxFileSizeBytes = 50 * 1024 * 1024 // 50MB
1517

16-
// Compress takes a path to a file or directory and creates a .tar.gzip file
17-
// at the outputPath location
18+
// Compress takes a path to a file or directory and creates a .tar.gzip file at the outputPath location.
1819
func Compress(path, outputPath string) error {
1920
tarFile, err := os.Create(filepath.Clean(outputPath))
2021
if err != nil {
@@ -58,8 +59,7 @@ func Compress(path, outputPath string) error {
5859
})
5960
}
6061

61-
// Decompress takes a location to a .tar.gzip file and a base path and
62-
// decompresses the contents wrt the base path
62+
// Decompress takes a location to a .tar.gzip file and a base path and decompresses the contents wrt the base path.
6363
func Decompress(tarPath, baseDir string) error {
6464
tarFile, err := os.Open(filepath.Clean(tarPath))
6565
if err != nil {
@@ -107,8 +107,7 @@ func Decompress(tarPath, baseDir string) error {
107107
}
108108
}
109109

110-
// CompressTar takes a path to a file or directory and creates a .tar file
111-
// at the outputPath location
110+
// CompressTar takes a path to a file or directory and creates a .tar file at the outputPath location.
112111
func CompressTar(path, outputPath string) error {
113112
tarFile, err := os.Create(filepath.Clean(outputPath))
114113
if err != nil {
@@ -149,8 +148,7 @@ func CompressTar(path, outputPath string) error {
149148
})
150149
}
151150

152-
// DecompressTar takes a location to a .tar file and a base path and
153-
// decompresses the contents wrt the base path
151+
// DecompressTar takes a location to a .tar file and a base path and decompresses the contents wrt the base path.
154152
func DecompressTar(tarPath, baseDir string) error {
155153
tarFile, err := os.Open(filepath.Clean(tarPath))
156154
if err != nil {
@@ -192,7 +190,7 @@ func DecompressTar(tarPath, baseDir string) error {
192190
}
193191
}
194192

195-
// TarCopy uses tar archive to copy src to dst to preserve the folder structure
193+
// TarCopy uses tar archive to copy src to dst to preserve the folder structure.
196194
func TarCopy(src, dst, tempDir string) error {
197195
f, err := os.CreateTemp(tempDir, "tarcopy-*.tar.gzip")
198196
if err != nil {

pkg/utils/logger.go

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var l sync.Mutex
1414

1515
const MaxNameLength = 20
1616

17+
// ColorLogger provides an io.Writer that can output in color.
1718
type ColorLogger struct {
1819
name string
1920
writer io.Writer

0 commit comments

Comments
 (0)