Skip to content

Instantly share code, notes, and snippets.

View sdomino's full-sized avatar

Steve Domino sdomino

View GitHub Profile
@Geoff-Ford
Geoff-Ford / composing-software.md
Last active November 10, 2024 09:04
Eric Elliott's Composing Software Series

Eric Elliott's "Composing Software" Series

A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.

Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.

package commands
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var (
package main
import (
"fmt"
"os"
"github.com/nanopack/hoarder/commands"
)
//
package commands
import (
"os"
"path/filepath"
"strings"
"time"
"github.com/spf13/cobra"
"github.com/spf13/viper"
package main
import (
"encoding/json"
"fmt"
"github.com/nanobox-io/golang-scribble"
)
// a fish
type Fish struct{ Name string }
// Tar takes a source and variable writers and walks 'source' writing each file
// found to the tar writer; the purpose for accepting multiple writers is to allow
// for multiple outputs (for example a file, or md5 hash)
func Tar(src string, writers ...io.Writer) error {
// ensure the src actually exists before trying to tar it
if _, err := os.Stat(src); err != nil {
return fmt.Errorf("Unable to tar files - %v", err.Error())
}
// Untar takes a destination path and a reader; a tar reader loops over the tarfile
// creating the file structure at 'dst' along the way, and writing any files
func Untar(dst string, r io.Reader) error {
gzr, err := gzip.NewReader(r)
if err != nil {
return err
}
defer gzr.Close()
package main
import (
"archive/tar"
"compress/gzip"
"crypto/md5"
"fmt"
"io"
"os"
"path/filepath"
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/go-fsnotify/fsnotify"
)
package main
import (
"fmt"
"github.com/go-fsnotify/fsnotify"
)
// main
func main() {