Skip to content

Commit ac1eba3

Browse files
authored
Merge pull request #2832 from embano1/issue-2830
2 parents 4c6c565 + 9ea287c commit ac1eba3

File tree

5 files changed

+118
-113
lines changed

5 files changed

+118
-113
lines changed

CONTRIBUTING.md

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44

55
First, fork the repository on GitHub to your personal account.
66

7-
Note that `GOPATH` can be any directory, the example below uses `$HOME/govmomi`.
8-
Change `$USER` below to your Github username if they are not the same.
9-
10-
```console
11-
$ export GOPATH=$HOME/govmomi
12-
$ go get github.com/vmware/govmomi
13-
14-
$ cd $GOPATH/src/github.com/vmware/govmomi
15-
$ git config push.default nothing # anything to avoid pushing to vmware/govmomi by default
16-
$ git remote rename origin vmware
17-
$ git remote add $USER [email protected]:$USER/govmomi.git
18-
$ git fetch $USER
7+
Change `$USER` in the examples below to your Github username if they are not the
8+
same.
9+
10+
```bash
11+
git clone https://github.com/vmware/govmomi.git && cd govmomi
12+
13+
# prevent accidentally pushing to vmware/govmomi
14+
git config push.default nothing
15+
git remote rename origin vmware
16+
17+
# add your fork
18+
git remote add $USER [email protected]:$USER/govmomi.git
19+
20+
git fetch -av
1921
```
2022

2123
## Contribution Flow
@@ -38,40 +40,40 @@ and **supported prefixes**, e.g. `govc: <message>`.
3840
3941
### Example 1 - Fix a Bug in `govmomi`
4042

41-
```console
42-
$ git checkout -b issue-<number> vmware/master
43-
$ git add <files>
44-
$ git commit -m "fix: ..." -m "Closes: #<issue-number>"
45-
$ git push $USER issue-<number>
43+
```bash
44+
git checkout -b issue-<number> vmware/master
45+
git add <files>
46+
git commit -m "fix: ..." -m "Closes: #<issue-number>"
47+
git push $USER issue-<number>
4648
```
4749

4850
### Example 2 - Add a new (non-breaking) API to `govmomi`
4951

50-
```console
51-
$ git checkout -b issue-<number> vmware/master
52-
$ git add <files>
53-
$ git commit -m "Add API ..." -m "Closes: #<issue-number>"
54-
$ git push $USER issue-<number>
52+
```bash
53+
git checkout -b issue-<number> vmware/master
54+
git add <files>
55+
git commit -m "Add API ..." -m "Closes: #<issue-number>"
56+
git push $USER issue-<number>
5557
```
5658

5759
### Example 3 - Add a Feature to `govc`
5860

59-
```console
60-
$ git checkout -b issue-<number> vmware/master
61-
$ git add <files>
62-
$ git commit -m "govc: Add feature ..." -m "Closes: #<issue-number>"
63-
$ git push $USER issue-<number>
61+
```bash
62+
git checkout -b issue-<number> vmware/master
63+
git add <files>
64+
git commit -m "govc: Add feature ..." -m "Closes: #<issue-number>"
65+
git push $USER issue-<number>
6466
```
6567
**Note**:
6668
To register the new `govc` command package, add a blank `_` import to `govmomi/govc/main.go`.
6769

6870
### Example 4 - Fix a Bug in `vcsim`
6971

70-
```console
71-
$ git checkout -b issue-<number> vmware/master
72-
$ git add <files>
73-
$ git commit -m "vcsim: Fix ..." -m "Closes: #<issue-number>"
74-
$ git push $USER issue-<number>
72+
```bash
73+
git checkout -b issue-<number> vmware/master
74+
git add <files>
75+
git commit -m "vcsim: Fix ..." -m "Closes: #<issue-number>"
76+
git push $USER issue-<number>
7577
```
7678

7779
### Example 5 - Document Breaking (API) Changes
@@ -84,10 +86,10 @@ The text after `BREAKING:` is used in the corresponding highlighted section.
8486
Thus these details should be stated at the body of the commit message.
8587
Multi-line strings are supported.
8688

87-
```console
88-
$ git checkout -b issue-<number> vmware/master
89-
$ git add <files>
90-
$ cat << EOF | git commit -F -
89+
```bash
90+
git checkout -b issue-<number> vmware/master
91+
git add <files>
92+
cat << EOF | git commit -F -
9193
Add ctx to funcXYZ
9294
9395
This commit introduces context.Context to function XYZ
@@ -96,19 +98,19 @@ Closes: #1234
9698
BREAKING: Add ctx to funcXYZ()
9799
EOF
98100

99-
$ git push $USER issue-<number>
101+
git push $USER issue-<number>
100102
```
101103

102104
### Stay in sync with Upstream
103105

104106
When your branch gets out of sync with the vmware/master branch, use the
105107
following to update (rebase):
106108

107-
```console
108-
$ git checkout issue-<number>
109-
$ git fetch -a
110-
$ git rebase vmware/master
111-
$ git push --force-with-lease $USER issue-<number>
109+
```bash
110+
git checkout issue-<number>
111+
git fetch -a
112+
git rebase vmware/master
113+
git push --force-with-lease $USER issue-<number>
112114
```
113115

114116
### Updating Pull Requests
@@ -120,25 +122,25 @@ is to assist the reviewer(s) to easily detect and review the recent changes.
120122
In case of small PRs, it's ok to squash and force-push (see further below)
121123
directly instead.
122124

123-
```console
125+
```bash
124126
# incorporate review feedback
125-
$ git add .
127+
git add .
126128

127129
# create a fixup commit which will be merged into your (original) <commit>
128-
$ git commit --fixup <commit>
129-
$ git push $USER issue-<number>
130+
git commit --fixup <commit>
131+
git push $USER issue-<number>
130132
```
131133

132134
Be sure to add a comment to the PR indicating your new changes are ready to
133135
review, as Github does not generate a notification when you git push.
134136

135137
Once the review is complete, squash and push your final commit(s):
136138

137-
```console
139+
```bash
138140
# squash all commits into one
139141
# --autosquash will automatically detect and merge fixup commits
140-
$ git rebase -i --autosquash vmware/master
141-
$ git push --force-with-lease $USER issue-<number>
142+
git rebase -i --autosquash vmware/master
143+
git push --force-with-lease $USER issue-<number>
142144
```
143145

144146
### Code Style
@@ -165,8 +167,8 @@ section in the `CHANGELOG`.
165167
The following example creates a commit referencing the `issue: 1234` and puts
166168
the commit message in the `govc` `CHANGELOG` section:
167169

168-
```console
169-
$ git commit -s -m "govc: Add CLI command X" -m "Closes: #1234"
170+
```bash
171+
git commit -s -m "govc: Add CLI command X" -m "Closes: #1234"
170172
```
171173

172174
Currently the following prefixes are used:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ See [godoc.org][godoc] for documentation.
3939

4040
### govmomi (Package)
4141

42-
```console
43-
$ go get -u github.com/vmware/govmomi
42+
```bash
43+
go get -u github.com/vmware/govmomi
4444
```
4545

4646
### Binaries and Docker Images for `govc` and `vcsim`

govc/README.md

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ You can find prebuilt `govc` binaries on the [releases page](https://github.com/
1616

1717
You can download and install a binary locally like this:
1818

19-
```console
19+
```bash
2020
# extract govc binary to /usr/local/bin
2121
# note: the "tar" command must run with root permissions
22-
$ curl -L -o - "https://github.com/vmware/govmomi/releases/latest/download/govc_$(uname -s)_$(uname -m).tar.gz" | tar -C /usr/local/bin -xvzf - govc
22+
curl -L -o - "https://github.com/vmware/govmomi/releases/latest/download/govc_$(uname -s)_$(uname -m).tar.gz" | tar -C /usr/local/bin -xvzf - govc
2323
```
2424

2525
### Source
2626

27-
#### Install via `go get`
27+
#### Install via `go install`
2828

2929
To build `govc` from source, first install the [Go
3030
toolchain](https://golang.org/dl/). You can then install the latest `govc` from
3131
Github using:
3232

33-
```console
34-
$ go get -u github.com/vmware/govmomi/govc
33+
```bash
34+
go install github.com/vmware/govmomi/govc@latest
3535
```
3636

3737
**Note:** `govmomi` and its binaries use [Go
@@ -46,8 +46,8 @@ source.
4646
If you've made local modifications to the repository at
4747
`$GOPATH/src/github.com/vmware/govmomi`, you can install using:
4848

49-
```console
50-
$ go install github.com/vmware/govmomi/govc
49+
```bash
50+
go install github.com/vmware/govmomi/govc
5151
```
5252

5353
#### Install via `goreleaser`
@@ -61,18 +61,18 @@ defined in [.goreleaser.yaml](./../.goreleaser.yml) and automatically set as
6161
Install `goreleaser` as per the installation
6262
[instructions](https://goreleaser.com/install/), then:
6363

64-
```console
65-
$ git clone https://github.com/vmware/govmomi.git
66-
$ cd govmomi
64+
```bash
65+
git clone https://github.com/vmware/govmomi.git
66+
cd govmomi
6767

6868
# pick a tag (>=v0.25.0)
69-
$ RELEASE=v0.25.0
69+
RELEASE=v0.25.0
7070

71-
$ git checkout ${RELEASE}
71+
git checkout ${RELEASE}
7272

7373
# build for the host OS/ARCH, otherwise omit --single-target
7474
# binaries are placed in respective subdirectories in ./dist/
75-
$ goreleaser build --rm-dist --single-target
75+
goreleaser build --rm-dist --single-target
7676
```
7777

7878
## Usage
@@ -122,21 +122,21 @@ using environment variables. The following environment variables are used by
122122

123123
* `GOVC_TLS_CA_CERTS`: Override system root certificate authorities.
124124

125-
```console
126-
$ export GOVC_TLS_CA_CERTS=~/.govc_ca.crt
125+
```bash
126+
export GOVC_TLS_CA_CERTS=~/.govc_ca.crt
127127
# Use path separator to specify multiple files:
128-
$ export GOVC_TLS_CA_CERTS=~/ca-certificates/bar.crt:~/ca-certificates/foo.crt
128+
export GOVC_TLS_CA_CERTS=~/ca-certificates/bar.crt:~/ca-certificates/foo.crt
129129
```
130130

131131
* `GOVC_TLS_KNOWN_HOSTS`: File(s) for thumbprint based certificate verification.
132132

133133
Thumbprint based verification can be used in addition to or as an alternative to
134134
`GOVC_TLS_CA_CERTS` for self-signed certificates. Example:
135135

136-
```console
137-
$ export GOVC_TLS_KNOWN_HOSTS=~/.govc_known_hosts
138-
$ govc about.cert -u host -k -thumbprint | tee -a $GOVC_TLS_KNOWN_HOSTS
139-
$ govc about -u user:pass@host
136+
```bash
137+
export GOVC_TLS_KNOWN_HOSTS=~/.govc_known_hosts
138+
govc about.cert -u host -k -thumbprint | tee -a $GOVC_TLS_KNOWN_HOSTS
139+
govc about -u user:pass@host
140140
```
141141

142142
* `GOVC_TLS_HANDSHAKE_TIMEOUT`: Limits the time spent performing the TLS handshake.
@@ -193,7 +193,7 @@ The`-debug` flag traces vSphere API calls similar to the `-trace` flag, but save
193193
When the `-debug` flag is specified, the default behavior is to put the output in `~/.govmomi/debug/<run timestamp>`.
194194
In that directory will be four (4) files per API call.
195195

196-
```
196+
```bash
197197
1-0001.req.headers #headers from the request sent to the API
198198
1-0001.req.xml #body content from request sent to the API
199199
1-0001.res.headers #headers from the response from the API
@@ -229,21 +229,22 @@ by setting the debug path to a dash: `export GOVC_DEBUG_PATH=-`
229229

230230
If you're using environment variables to set `GOVC_URL`, verify the values are set as expected:
231231
232-
```console
233-
$ govc env
232+
```bash
233+
govc env
234234
```
235235
236236
### Connection issues
237237
238238
Check your proxy settings:
239239
240-
```console
241-
$ env | grep -i https_proxy
240+
```bash
241+
env | grep -i https_proxy
242242
```
243243
244-
Test connection using curl:
245-
```console
246-
$ curl --verbose -k -X POST https://x.x.x.x/sdk
244+
Test connection using `curl`:
245+
246+
```bash
247+
curl --verbose -k -X POST https://x.x.x.x/sdk
247248
```
248249
249250
### MSYS2 (Windows)
@@ -258,8 +259,8 @@ cookies, resulting in a `NotAuthenticated` error. For example, running `govc`
258259
directly against the vCenter vpxd endpoint at `http://127.0.0.1:8085`. Set the
259260
environment variable `GOVMOMI_INSECURE_COOKIES=true` to workaround this:
260261

261-
```console
262-
$ GOVMOMI_INSECURE_COOKIES=true govc ls -u http://user:[email protected]:8085
262+
```bash
263+
GOVMOMI_INSECURE_COOKIES=true govc ls -u http://user:[email protected]:8085
263264
```
264265

265266
## Examples
@@ -290,8 +291,8 @@ When new `govc` commands or flags are added, the PATCH version will be
290291
incremented. This enables you to require a minimum version from within a
291292
script, for example:
292293

293-
```console
294-
$ govc version -require 0.24
294+
```bash
295+
govc version -require 0.24
295296
```
296297

297298
## Projects using `govc`

vapi/library/finder/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ While a system that has few content library objects benefits from wildcard searc
3838
## `govc library.ls`
3939

4040
### Listing all the objects in the content library
41-
```shell
41+
42+
```console
4243
$ govc library.ls '*/*/'
4344
/ISOs/CentOS-7-x86_64-Minimal-1804/CentOS-7-x86_64-Minimal-1804.iso
4445
/ISOs/CoreOS Production/coreos_production_iso_image.iso
@@ -72,7 +73,8 @@ $ govc library.ls '*/*/'
7273
## `govc library.info`
7374

7475
### Getting the info for all the objects in the content library
75-
```shell
76+
77+
```console
7678
$ govc library.info '*/*/'
7779
Name: CentOS-7-x86_64-Minimal-1804.iso
7880
Path: /ISOs/CentOS-7-x86_64-Minimal-1804/CentOS-7-x86_64-Minimal-1804.iso

0 commit comments

Comments
 (0)