mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 09:16:29 +00:00
docs: add a short document about coding style recommendation
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
e2e123e464
commit
deffc1f143
15
docs/coding-style.md
Normal file
15
docs/coding-style.md
Normal file
@ -0,0 +1,15 @@
|
||||
## Shell scripts
|
||||
Shell scripts should loosely follow the general Alpine style which is derived from the Linux Kernel guidelines, i.e. tabs for indentation etc.
|
||||
|
||||
It's also useful to run `shellcheck` on the scripts.
|
||||
|
||||
## Go code
|
||||
New Go code should be formatted with `gofmt`
|
||||
|
||||
## C code
|
||||
C code written from scratch should follow the
|
||||
[Linux kernel coding guidelines](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/CodingStyle)
|
||||
as much as it makes sense for userspace code. You can check your code with [checkpatch.pl](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/scripts/checkpatch.pl) like this:
|
||||
```
|
||||
checkpatch.pl --no-tree --file <sourcefile>
|
||||
```
|
Loading…
Reference in New Issue
Block a user