Skip to content

Commit

Permalink
Complete rewrite to use golang/dep for source deduction
Browse files Browse the repository at this point in the history
  • Loading branch information
CrushedPixel committed Mar 28, 2018
1 parent 027b3cc commit a19f579
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 413 deletions.
14 changes: 6 additions & 8 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,9 @@


[[constraint]]
branch = "master"
name = "github.com/golang/dep"
version = "0.4.1"

[[constraint]]
name = "github.com/pelletier/go-toml"
version = "1.1.0"

[[constraint]]
name = "github.com/pkg/errors"
version = "0.8.0"
source = "https://github.com/CrushedPixel/dep"

[prune]
go-tests = true
Expand Down
52 changes: 52 additions & 0 deletions deps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package main

import (
"fmt"
)

const depNixFormat = `
{
goPackagePath = "%s";
fetch = {
type = "%s";
url = "%s";
rev = "%s";
sha256 = "%s";
};
}`

// Dep represents a project dependency
// to write to deps.nix.
type Dep struct {
PackagePath string
VCS string
URL string
Revision string
SHA256 string
}

// toNix converts d into a nix set
// for use in the generated deps.nix.
func (d *Dep) toNix() string {
return fmt.Sprintf(depNixFormat,
d.PackagePath, d.VCS, d.URL,
d.Revision, d.SHA256)
}

const depsFileHeader = `# file generated from Gopkg.lock using dep2nix (https://github.com/nixcloud/dep2nix)
[`
const depsFileFooter = `
]`

type Deps []*Dep

// toNix converts d into a deps.nix file
// for use with pkgs.buildGoPackage.
func (d Deps) toNix() string {
nix := depsFileHeader
for _, dep := range d {
nix += dep.toNix()
}
nix += depsFileFooter
return nix
}
6 changes: 3 additions & 3 deletions deps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
goPackagePath = "github.com/golang/dep";
fetch = {
type = "git";
url = "https://github.com/golang/dep";
rev = "37d9ea0ac16f0e0a05afc3b60e1ac8c364b6c329";
sha256 = "0183xq5l4sinnclynv6xi85vmk69mqpy5wjfsgh8bxwziq3vkd7y";
url = "https://github.com/CrushedPixel/dep";
rev = "fa9f32339c8855ebe7e7bc66e549036a7e06d37a";
sha256 = "1knaxs1ji1b0b68393f24r8qzvahxz9x7rqwc8jsjlshvpz0hlm6";
};
}

Expand Down
203 changes: 0 additions & 203 deletions lock.go

This file was deleted.

Loading

0 comments on commit a19f579

Please sign in to comment.