Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
6ef60b68
Unverified
Commit
6ef60b68
authored
8 years ago
by
Silas Davis
Browse files
Options
Downloads
Patches
Plain Diff
Include package in lock, and make sure everything installed
parent
2fc504a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hell
+3
-0
3 additions, 0 deletions
hell
util/hell/README.md
+8
-1
8 additions, 1 deletion
util/hell/README.md
util/hell/cmd/hell/main.go
+34
-19
34 additions, 19 deletions
util/hell/cmd/hell/main.go
with
45 additions
and
20 deletions
hell
0 → 100644
+
3
−
0
View file @
6ef60b68
#!/usr/bin/env bash
go run ./util/hell/cmd/hell/main.go
"
$@
"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
util/hell/README.md
+
8
−
1
View file @
6ef60b68
> Hell is other people's packages
While we wait for working package management in go we need a way to make
maintaining the glide.lock by hand less painful.
\ No newline at end of file
maintaining the glide.lock by hand less painful.
To interactively add a package run from the root:
```
bash
go run ./util/hell/cmd/hell/main.go get
--interactive
github.com/tendermint/tendermint
```
This diff is collapsed.
Click to expand it.
util/hell/cmd/hell/main.go
+
34
−
19
View file @
6ef60b68
...
...
@@ -74,37 +74,52 @@ func main() {
}
rootPackage
,
_
:=
util
.
NormalizeName
(
args
[
0
])
// Add dependency to glide
action
.
Get
(
args
,
repo
.
NewInstaller
(),
false
,
true
,
false
,
!
interactive
,
false
)
installer
:=
repo
.
NewInstaller
()
action
.
Get
(
args
,
installer
,
false
,
true
,
false
,
!
interactive
,
false
)
// Now hunt down the repo cache
dep
:=
action
.
EnsureConfig
()
.
Imports
.
Get
(
rootPackage
)
key
,
err
:=
cache
.
Key
(
dep
.
Remote
())
if
err
!=
nil
{
msg
.
Die
(
"%s requires a single argument of the remote dependency
\n
"
,
cmd
.
Name
())
}
cacheDir
:=
filepath
.
Join
(
cache
.
Location
(),
"src"
,
key
)
repos
,
err
:=
dep
.
GetRepo
(
cacheDir
)
if
err
!=
nil
{
msg
.
Die
(
"Could not get repo: %s"
,
err
)
}
version
,
err
:=
repos
.
Version
()
if
err
!=
nil
{
msg
.
Die
(
"Could not get version: %s"
,
err
)
}
dep
.
Pin
=
version
lockPath
:=
filepath
.
Join
(
"."
,
path
.
LockFile
)
baseLockFile
,
err
:=
cfg
.
ReadLockFile
(
lockPath
)
if
err
!=
nil
{
msg
.
Die
(
"Could not read base lock file: %s"
,
err
)
}
overrideLockFile
:=
&
cfg
.
Lockfile
{}
if
path
.
HasLock
(
cacheDir
)
{
msg
.
Info
(
"Found dependency lock file, merging into project lock file"
)
lockPath
:=
filepath
.
Join
(
"."
,
path
.
LockFile
)
baseLockFile
,
err
:=
cfg
.
ReadLockFile
(
lockPath
)
if
err
!=
nil
{
msg
.
Die
(
"Could not read base lock file: %s"
,
err
)
}
overrideLockFile
,
err
:=
cfg
.
ReadLockFile
(
filepath
.
Join
(
cacheDir
,
path
.
LockFile
))
msg
.
Info
(
"Found dependency lock file so merging into project lock file"
)
overrideLockFile
,
err
=
cfg
.
ReadLockFile
(
filepath
.
Join
(
cacheDir
,
path
.
LockFile
))
if
err
!=
nil
{
msg
.
Die
(
"Could not read dependency lock file: %s"
,
err
)
}
mergedLockFile
,
err
:=
hell
.
MergeGlideLockFiles
(
baseLockFile
,
overrideLockFile
)
if
err
!=
nil
{
msg
.
Die
(
"Could not merge lock files: %s
\n
"
,
err
)
}
err
=
mergedLockFile
.
WriteFile
(
lockPath
)
if
err
!=
nil
{
msg
.
Die
(
"Could not write merged lock file: %s"
,
err
)
}
}
else
{
msg
.
Info
(
"Did not find dependency lock file, so nothing merged intoo project lock file"
)
}
// Add the package to glide lock too!
overrideLockFile
.
Imports
=
append
(
overrideLockFile
.
Imports
,
cfg
.
LockFromDependency
(
dep
))
mergedLockFile
,
err
:=
hell
.
MergeGlideLockFiles
(
baseLockFile
,
overrideLockFile
)
fmt
.
Printf
(
"%#v
\n
"
,
mergedLockFile
.
Imports
)
if
err
!=
nil
{
msg
.
Die
(
"Could not merge lock files: %s
\n
"
,
err
)
}
err
=
mergedLockFile
.
WriteFile
(
lockPath
)
if
err
!=
nil
{
msg
.
Die
(
"Could not write merged lock file: %s"
,
err
)
}
action
.
Install
(
installer
,
false
)
},
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment