File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module github.com/sylabs/sif
33go 1.15
44
55require (
6- github.com/satori/go.uuid v1.2.0
6+ github.com/satori/go.uuid v1.2.1-0.20180404165556-75cca531ea76
77 github.com/spf13/cobra v1.1.3
88 golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e
99)
Original file line number Diff line number Diff line change @@ -140,8 +140,8 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
140140github.1485827954.workers.dev/rogpeppe/go-internal v1.3.0 /go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4 =
141141github.1485827954.workers.dev/russross/blackfriday/v2 v2.0.1 /go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM =
142142github.1485827954.workers.dev/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f /go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts =
143- github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww =
144- github.com/satori/go.uuid v1.2.0 /go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0 =
143+ github.com/satori/go.uuid v1.2.1-0.20180404165556-75cca531ea76 h1:ofyVTM1w4iyKwaQIlRR6Ip06mXXx5Cnz7a4mTGYq1hE =
144+ github.com/satori/go.uuid v1.2.1-0.20180404165556-75cca531ea76 /go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0 =
145145github.1485827954.workers.dev/sean-/seed v0.0.0-20170313163322-e2103e2c3529 /go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc =
146146github.1485827954.workers.dev/shurcooL/sanitized_anchor_name v1.0.0 /go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc =
147147github.1485827954.workers.dev/sirupsen/logrus v1.2.0 /go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo =
Original file line number Diff line number Diff line change 1- // Copyright (c) 2018-2019 , Sylabs Inc. All rights reserved.
1+ // Copyright (c) 2018-2021 , Sylabs Inc. All rights reserved.
22// Copyright (c) 2018, Divya Cote <divya.cote@gmail.com> All rights reserved.
33// Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
44// Copyright (c) 2017, Yannick Cote <yhcote@gmail.com> All rights reserved.
@@ -19,19 +19,20 @@ import (
1919
2020// New creates a new empty SIF file.
2121func New (file string ) error {
22+ id , err := uuid .NewV4 ()
23+ if err != nil {
24+ return err
25+ }
26+
2227 cinfo := sif.CreateInfo {
2328 Pathname : file ,
2429 Launchstr : sif .HdrLaunch ,
2530 Sifversion : sif .HdrVersion ,
26- ID : uuid . NewV4 () ,
31+ ID : id ,
2732 }
2833
29- _ , err := sif .CreateContainer (cinfo )
30- if err != nil {
31- return err
32- }
33-
34- return nil
34+ _ , err = sif .CreateContainer (cinfo )
35+ return err
3536}
3637
3738// AddOptions contains the options when adding a section to a SIF file.
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2020-2021, Sylabs Inc. All rights reserved.
2+ // This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
3+ // distributed with the sources of this project regarding your rights to use or distribute this
4+ // software.
5+
16package main
27
38import (
@@ -13,15 +18,20 @@ import (
1318)
1419
1520func createImage (path string , dis []sif.DescriptorInput ) error {
21+ id , err := uuid .NewV4 ()
22+ if err != nil {
23+ return err
24+ }
25+
1626 ci := sif.CreateInfo {
1727 Pathname : path ,
1828 Launchstr : sif .HdrLaunch ,
1929 Sifversion : sif .HdrVersion ,
20- ID : uuid . NewV4 () ,
30+ ID : id ,
2131 InputDescr : dis ,
2232 }
2333
24- _ , err : = sif .CreateContainer (ci )
34+ _ , err = sif .CreateContainer (ci )
2535 return err
2636}
2737
Original file line number Diff line number Diff line change 1- // Copyright (c) 2018-2020 , Sylabs Inc. All rights reserved.
1+ // Copyright (c) 2018-2021 , Sylabs Inc. All rights reserved.
22// This software is licensed under a 3-clause BSD license. Please consult the
33// LICENSE file distributed with the sources of this project regarding your
44// rights to use or distribute this software.
@@ -60,12 +60,17 @@ func TestDataStructs(t *testing.T) {
6060}
6161
6262func TestCreateContainer (t * testing.T ) {
63+ id , err := uuid .NewV4 ()
64+ if err != nil {
65+ t .Fatal (err )
66+ }
67+
6368 // general info for the new SIF file creation
6469 cinfo := CreateInfo {
6570 Pathname : "testdata/testcontainer.sif" ,
6671 Launchstr : HdrLaunch ,
6772 Sifversion : HdrVersion ,
68- ID : uuid . NewV4 () ,
73+ ID : id ,
6974 }
7075
7176 // test container creation without any input descriptors
You can’t perform that action at this time.
0 commit comments