If you're looking to contribute to this project, there's a few things you should know.
First, make sure you go through the README.
Second, it's written in Go. If you are new to Go, we recommend the following resources:
- Go 1.19+
- Task
- detect-secrets
You should already have installed Go.
You will need to install Task in order to
run the commands in the Taskfile.yml
. This file is used to run the commands
that are used to build, test, and lint. (Feel free to add commands to this file
if you find it useful!)
Clone the repo.
$ git clone git@github.com:CircleCI-Public/circleci-yaml-language-server.git
$ cd circleci-yaml-language-server
If you cloned the repo inside of your $GOPATH
, you can use GO111MODULE=on
in
order to use Go modules. We recommend cloning the repo outside of $GOPATH
as
you would any other source code project, for example
~/code/circleci-yaml-language-server
.
$ task init
$ task build
Note: bin/start_server
is the entry point for the language server.
$ task test
We use Go 1.19 Modules for managing our dependencies.
You can read more about it on the wiki: https://github.com/golang/go/wiki/Modules
We use gofmt
for linting.
In order to lint your code, you can run this command:
$ task lint
Go has great tooling such as gofmt
and
goimports
.
In particular, please be sure to gofmt
your code before committing.
You can install goimport
via:
$ go get golang.org/x/tools/cmd/goimports
The golang blog post
"go fmt your code" has a lot more
info gofmt
. To get it setup with vim or
emacs.
For example, I've the following in my .emacs.d/init.el
:
(setq gofmt-command "goimports")
(require 'go-mode)
(add-hook 'before-save-hook 'gofmt-before-save)
(require 'go-rename)
This repository embed a VSCode extension (located at editors/vscode
) so you
can test your code within the editor.
- In order to run the extension, you must first prepare installation. This command will install the necessary node packages and build the extension:
task prepare:vscode
-
You need to disable the CircleCI marketplace extension before testing in order to avoid conflicts between the two extensions (the local one and the marketplace one). To do so, please go to the
Extensions
tab, click on the CircleCI extension and click onDisable
-
Next, open a VSCode instance at the root of the project, open the
Run and Debug
tab and run it via theRun Extension
on the dropdown menu at the top of the tab.