Skip to content

Commit

Permalink
Merge pull request #8 from tri-adam/bump-uuid
Browse files Browse the repository at this point in the history
Bump github.com/satori/go.uuid Module
  • Loading branch information
tri-adam authored May 7, 2021
2 parents c256955 + d1aae9c commit 1939628
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/sylabs/sif
go 1.15

require (
github.com/satori/go.uuid v1.2.0
github.com/satori/go.uuid v1.2.1-0.20180404165556-75cca531ea76
github.com/spf13/cobra v1.1.3
golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/satori/go.uuid v1.2.1-0.20180404165556-75cca531ea76 h1:ofyVTM1w4iyKwaQIlRR6Ip06mXXx5Cnz7a4mTGYq1hE=
github.com/satori/go.uuid v1.2.1-0.20180404165556-75cca531ea76/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
Expand Down
17 changes: 9 additions & 8 deletions internal/app/siftool/modif.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2019, Sylabs Inc. All rights reserved.
// Copyright (c) 2018-2021, Sylabs Inc. All rights reserved.
// Copyright (c) 2018, Divya Cote <divya.cote@gmail.com> All rights reserved.
// Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
// Copyright (c) 2017, Yannick Cote <yhcote@gmail.com> All rights reserved.
Expand All @@ -19,19 +19,20 @@ import (

// New creates a new empty SIF file.
func New(file string) error {
id, err := uuid.NewV4()
if err != nil {
return err
}

cinfo := sif.CreateInfo{
Pathname: file,
Launchstr: sif.HdrLaunch,
Sifversion: sif.HdrVersion,
ID: uuid.NewV4(),
ID: id,
}

_, err := sif.CreateContainer(cinfo)
if err != nil {
return err
}

return nil
_, err = sif.CreateContainer(cinfo)
return err
}

// AddOptions contains the options when adding a section to a SIF file.
Expand Down
14 changes: 12 additions & 2 deletions pkg/integrity/testdata/gen_sifs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) 2020-2021, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
// distributed with the sources of this project regarding your rights to use or distribute this
// software.

package main

import (
Expand All @@ -13,15 +18,20 @@ import (
)

func createImage(path string, dis []sif.DescriptorInput) error {
id, err := uuid.NewV4()
if err != nil {
return err
}

ci := sif.CreateInfo{
Pathname: path,
Launchstr: sif.HdrLaunch,
Sifversion: sif.HdrVersion,
ID: uuid.NewV4(),
ID: id,
InputDescr: dis,
}

_, err := sif.CreateContainer(ci)
_, err = sif.CreateContainer(ci)
return err
}

Expand Down
9 changes: 7 additions & 2 deletions pkg/sif/create_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020, Sylabs Inc. All rights reserved.
// Copyright (c) 2018-2021, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand Down Expand Up @@ -60,12 +60,17 @@ func TestDataStructs(t *testing.T) {
}

func TestCreateContainer(t *testing.T) {
id, err := uuid.NewV4()
if err != nil {
t.Fatal(err)
}

// general info for the new SIF file creation
cinfo := CreateInfo{
Pathname: "testdata/testcontainer.sif",
Launchstr: HdrLaunch,
Sifversion: HdrVersion,
ID: uuid.NewV4(),
ID: id,
}

// test container creation without any input descriptors
Expand Down

0 comments on commit 1939628

Please sign in to comment.