GithubHelp home page GithubHelp logo

enterprise-contract / go-gather Goto Github PK

View Code? Open in Web Editor NEW
1.0 6.0 3.0 253 KB

Download files from various sources. Like hashicorp/go-getter but lighter and with less dependencies. (Soon to be) used by ec-cli.

License: Apache License 2.0

Go 98.17% Makefile 1.83%

go-gather's Introduction

go-gather

WIP, experimental, sharp edges.

Examples

Copy file to file

package main

import (
	"context"
	"fmt"

	"github.com/enterprise-contract/go-gather/gather"
)

func main() {
	ctx := context.Background()
	metadata, err := gather.Gather(ctx, "file:///tmp/foo.txt", "file:///tmp/bar.txt")

	if err != nil {
		fmt.Println("error:", err)
	}

	fmt.Println(metadata.Get())
}

Executing the above,

$ go run main.go

produces the following output:

map[path:file:///tmp/baz/bar.txt sha:ef4e93945f5b3d481abe655d6ce3870132994c0bd5840e312d7ac97cde021050 size:71680 timestamp:2024-04-25 09:18:20.978669581 -0400 EDT]

Copy directory to directory

package main

import (
	"context"
	"fmt"

	"github.com/enterprise-contract/go-gather/gather"
)

func main() {
	ctx := context.Background()
	metadata, err := gather.Gather(ctx, "file:///tmp/foo", "file:///tmp/bar")

	if err != nil {
		fmt.Println("error:", err)
	}

	fmt.Println(metadata.Get())
}

Executing the above,

$ go run main.go

produces the following output:

map[path:/tmp/bar/ size:0 timestamp:2024-04-25 09:57:20.863229843 -0400 EDT]

Clone git repo to local filesystem

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/enterprise-contract/go-gather/gather"
)

func main() {
	ctx := context.Background()
	destination := "/tmp/repo"
	source := "git::[email protected]:example/example.git"
	metadata, err := gather.Gather(ctx, sourcep, destination)
	if err != nil {
		fmt.Println(err)
		panic(err)
	}
	fmt.Printf(metadata.Get())
}

Executing the above,

$ go run main.go

produces the following output:

 map[size:1024 path:/path/to/file.txt timestamp:2022-01-01 12:00:00 +0000 UTC commits:[{689da11ffaef9d523615b3518cb1f2916a37ec42 {J Doe [email protected] 2022-01-01 12:00:00 +0000 +0000} {J Doe [email protected] 2022-01-01 12:00:00 +0000 +0000} Add new shiny feature [58b071e48f6e9e81ede4f284ee2c2aeeb06b3625] UTF-8 0xc0000d62c0}] path: size:0 timestamp:0001-01-01 00:00:00 +0000 UTC]

go-gather's People

Contributors

robnester-rh avatar renovate[bot] avatar zregvart avatar lcarva avatar dependabot[bot] avatar joejstuart avatar simonbaird avatar

Stargazers

chennqqi avatar

Watchers

 avatar  avatar  avatar Mark Bestavros avatar  avatar  avatar

go-gather's Issues

Review and improve Dependabot and Renovate behavior

Goals:

  • Reduce the high number of automated dependency bot PRs
    • Consider reducing the frequency of PR creation, or grouping dependency updates into less PRs, or switching off some categories of updates
  • Ensure the PRs generated are useful and sane

I'm lumping both Dependabot and Renovate together here. Feel free to split this up if it makes sense.

Notes:

  • Not sure if the Jira sync will work in this repo, but let's try it..
  • ec-cli config might be a useful reference, see here and here IIUC.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/scorecard.yml
  • step-security/harden-runner v2.9.1@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • ossf/scorecard-action v2.4.0@62b2cac7ed8198b15735ed49ab1e5cf35480ba46
  • actions/upload-artifact v4.3.6@834a144ee995460fba8ed112a2fc961b36a5ec5a
  • github/codeql-action v3.26.0@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa
gomod
expander/go.mod
  • go 1.21.9
gather/file/go.mod
  • go 1.21.9
  • github.com/enterprise-contract/go-gather/expander v0.0.1
  • github.com/enterprise-contract/go-gather/metadata v0.0.2
  • github.com/enterprise-contract/go-gather/metadata/file v0.0.1
  • github.com/enterprise-contract/go-gather/saver v0.0.1
gather/git/go.mod
  • go 1.21.9
  • github.com/chainguard-dev/git-urls v1.0.2
  • github.com/enterprise-contract/go-gather v0.0.3
  • github.com/enterprise-contract/go-gather/metadata v0.0.2
  • github.com/enterprise-contract/go-gather/metadata/git v0.0.2
  • github.com/go-git/go-git/v5 v5.12.0
  • github.com/stretchr/testify v1.9.0
gather/go.mod
  • go 1.21.9
  • github.com/enterprise-contract/go-gather v0.0.3
  • github.com/enterprise-contract/go-gather/gather/file v0.0.1
  • github.com/enterprise-contract/go-gather/gather/git v0.0.5
  • github.com/enterprise-contract/go-gather/gather/http v0.0.2
  • github.com/enterprise-contract/go-gather/gather/oci v0.0.4
  • github.com/enterprise-contract/go-gather/metadata v0.0.2
  • github.com/enterprise-contract/go-gather/metadata/git v0.0.2
gather/http/go.mod
  • go 1.21.9
  • github.com/enterprise-contract/go-gather v0.0.3
  • github.com/enterprise-contract/go-gather/metadata v0.0.2
  • github.com/enterprise-contract/go-gather/metadata/http v0.0.1
  • github.com/enterprise-contract/go-gather/saver v0.0.1
  • github.com/stretchr/testify v1.9.0
gather/oci/go.mod
  • go 1.21.9
  • github.com/enterprise-contract/go-gather/metadata v0.0.2
  • github.com/enterprise-contract/go-gather/metadata/oci v0.0.3
  • oras.land/oras-go/v2 v2.5.0
  • github.com/opencontainers/image-spec v1.1.0
  • github.com/spf13/viper v1.19.0
  • github.com/stretchr/testify v1.9.0
go.mod
  • go 1.21.9
metadata/file/go.mod
  • go 1.21.9
metadata/git/go.mod
  • go 1.21.9
  • github.com/go-git/go-git/v5 v5.12.0
  • github.com/stretchr/testify v1.9.0
metadata/go.mod
  • go 1.21.9
metadata/http/go.mod
  • go 1.21.9
metadata/oci/go.mod
  • go 1.21.9
  • github.com/stretchr/testify v1.9.0
saver/file/go.mod
  • go 1.21.9
saver/go.mod
  • go 1.21.9
  • github.com/enterprise-contract/go-gather/saver/file v0.0.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.