Skip to content

Commit 61eddbb

Browse files
Julien LevasseurJulien Levasseur
authored andcommitted
Merge pull request #3 from julienlevasseur/update-goInfo
Update goInfo
2 parents f683593 + 20d085d commit 61eddbb

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ go 1.13
44

55
require (
66
github.com/hashicorp/terraform-plugin-sdk/v2 v2.3.0
7-
github.com/matishsiao/goInfo v0.0.0-20200404012835-b5f882ee2288
7+
github.com/matishsiao/goInfo v0.0.0-20210923090445-da2e3fa8d45f
88
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
188188
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
189189
github.com/matishsiao/goInfo v0.0.0-20200404012835-b5f882ee2288 h1:cdM7et8/VlNnSBpq3KbyQWsYLCY0WsB7tvV8Fr0DUNE=
190190
github.com/matishsiao/goInfo v0.0.0-20200404012835-b5f882ee2288/go.mod h1:yLZrFIhv+Z20hxHvcZpEyKVQp9HMsOJkXAxx7yDqtvg=
191+
github.com/matishsiao/goInfo v0.0.0-20210923090445-da2e3fa8d45f h1:B0OD7nYl2FPQEVrw8g2uyc1lGEzNbvrKh7fspGZcbvY=
192+
github.com/matishsiao/goInfo v0.0.0-20210923090445-da2e3fa8d45f/go.mod h1:aEt7p9Rvh67BYApmZwNDPpgircTO2kgdmDUoF/1QmwA=
191193
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
192194
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
193195
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=

internal/provider/data_source_uname.go

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,36 @@ func dataSourceUname() *schema.Resource {
3535
}
3636

3737
func dataSourceUnameRead(d *schema.ResourceData, _ interface{}) error {
38-
//
3938

40-
d.Set("kernel_name", goInfo.GetInfo().Kernel)
41-
d.Set("nodename", goInfo.GetInfo().Hostname)
42-
d.Set("kernel_release", goInfo.GetInfo().Core)
43-
d.Set("machine", goInfo.GetInfo().Platform)
44-
d.Set("operating_system", goInfo.GetInfo().OS)
39+
goInfo, err := goInfo.GetInfo()
40+
if err != nil {
41+
return err
42+
}
43+
44+
err = d.Set("kernel_name", goInfo.Kernel)
45+
if err != nil {
46+
return err
47+
}
48+
49+
err = d.Set("nodename", goInfo.Hostname)
50+
if err != nil {
51+
return err
52+
}
53+
54+
err = d.Set("kernel_release", goInfo.Core)
55+
if err != nil {
56+
return err
57+
}
58+
59+
err = d.Set("machine", goInfo.Platform)
60+
if err != nil {
61+
return err
62+
}
63+
64+
err = d.Set("operating_system", goInfo.OS)
65+
if err != nil {
66+
return err
67+
}
4568

4669
return nil
4770

0 commit comments

Comments
 (0)