Skip to content

Commit 7b5b815

Browse files
authored
[README] Use go build to install from source code (#32)
Signed-off-by: Prasad Ghangal <[email protected]>
1 parent c810d2e commit 7b5b815

File tree

1 file changed

+4
-100
lines changed

1 file changed

+4
-100
lines changed

README.md

+4-100
Original file line numberDiff line numberDiff line change
@@ -10,111 +10,15 @@ Converts YAML specs into Go type definitions
1010

1111
### Binary Installation
1212

13-
Pre-compiled binaries are available on the releases page. You can download the correct binary depending on your system arch, put it into $PATH and hit `yaml2go help`
13+
Pre-compiled binaries are available on the releases page. You can download the correct binary depending on your system arch, put it into `$PATH` and hit `yaml2go help`
1414

1515
### Install From Source
1616

17-
#### Step 1: Clone the repo
18-
```bash
19-
$ git clone https://github.com/PrasadG193/yaml2go.git $GOPATH/src/github.com/PrasadG193/yaml2go
20-
```
21-
22-
#### Step 2: Build binary using go install
23-
```bash
24-
$ go install $GOPATH/src/github.com/PrasadG193/yaml2go
25-
```
26-
27-
#### Step 3: Convert YAML specs into Go type
17+
Build binary using go build
2818

2919
```bash
30-
$ cat example1.yaml
31-
kind: test
32-
metadata:
33-
name: cluster
34-
nullfield:
35-
nestedstruct:
36-
- nested:
37-
underscore_field: value
38-
field1:
39-
- 44.5
40-
- 43.6
41-
field2:
42-
- true
43-
- false
44-
nested2:
45-
- nested3:
46-
field1:
47-
- 44
48-
- 43
49-
fieldt:
50-
- true
51-
- false
52-
field3: value
53-
abc:
54-
- def:
55-
- black
56-
- white
57-
array1:
58-
- "string1"
59-
- "string2"
60-
array2:
61-
- 2
62-
- 6
63-
array3:
64-
- 3.14
65-
- 5.12
66-
is_underscore: true
67-
```
68-
69-
```bash
70-
$ GOPATH/bin/yaml2go < example1.yaml
71-
// Yaml2Go
72-
type Yaml2Go struct {
73-
Kind string `yaml:"kind"`
74-
Metadata Metadata `yaml:"metadata"`
75-
Abc []Abc `yaml:"abc"`
76-
Array1 []string `yaml:"array1"`
77-
Array2 []int `yaml:"array2"`
78-
Array3 []float64 `yaml:"array3"`
79-
IsUnderscore bool `yaml:"is_underscore"`
80-
}
81-
82-
// Metadata
83-
type Metadata struct {
84-
Name string `yaml:"name"`
85-
Nullfield interface{} `yaml:"nullfield"`
86-
Nestedstruct []Nestedstruct `yaml:"nestedstruct"`
87-
}
88-
89-
// Nested3
90-
type Nested3 struct {
91-
Field1 []int `yaml:"field1"`
92-
Fieldt []bool `yaml:"fieldt"`
93-
Field3 string `yaml:"field3"`
94-
}
95-
96-
// Abc
97-
type Abc struct {
98-
Def []string `yaml:"def"`
99-
}
100-
101-
// Nestedstruct
102-
type Nestedstruct struct {
103-
Nested Nested `yaml:"nested"`
104-
Nested2 []Nested2 `yaml:"nested2"`
105-
}
106-
107-
// Nested
108-
type Nested struct {
109-
UnderscoreField string `yaml:"underscore_field"`
110-
Field1 []float64 `yaml:"field1"`
111-
Field2 []bool `yaml:"field2"`
112-
}
113-
114-
// Nested2
115-
type Nested2 struct {
116-
Nested3 Nested3 `yaml:"nested3"`
117-
}
20+
$ go get -u github.com/PrasadG193/yaml2go
21+
$ go build -o yaml2go github.com/PrasadG193/yaml2go/cmd/cli
11822
```
11923

12024
## Usage

0 commit comments

Comments
 (0)