---
# System prepended metadata

title: Style Guide constituents
tags: [code quality]

---

---
tags: code quality
---

# Style Guide constituents

## PRs

I chose the below PRs out of all PRs that have the `Cleanup` label applied, and added a few more.

### Victor

- https://github.com/prysmaticlabs/prysm/pull/7529 
    - use `error.Is(err, errType)` instead of `err == errType`
    - use `%w` instead of `%v` when wrapping errors using `fmt.Errorf` (*might* be not needed after error handling revamp)
- https://github.com/prysmaticlabs/prysm/pull/8158
    - do not use variable names colliding with names of imported packages
- https://github.com/prysmaticlabs/prysm/pull/8193
    - compare strings using `strings.EqualFold()` instead of `strings.ToLower()` or `strings.ToUpper()`

### Terence

- https://github.com/prysmaticlabs/prysm/pull/8228
    - create `HydrateXyz` helpers to avoid defining empty arrays in each test
- https://github.com/prysmaticlabs/prysm/pull/8337 and https://github.com/prysmaticlabs/prysm/pull/8320
    - do not prefix getter functions with `get`
    - name constructors `New` if the package name makes it clear what is being created (e.g. `service.New`)
    - name constructors `NewXyz` if the package name does not make it clear what is being created (e.g. `helpers.NewSlotTicker`)

### Radek

- https://github.com/prysmaticlabs/prysm/pull/8245
    - create a `log.go` file for each package and declare a logger variable inside this file
- https://github.com/prysmaticlabs/prysm/pull/8317
    - do not create files ending with `_mock` as their diffs will be hidden by default in the PR
- https://github.com/prysmaticlabs/prysm/pull/8318
    - use `assert.DeepEqual` instead of `bytes.Equal` for comparing byte slices in tests

### Other
- Declare receiver functions on pointer types

## Questions

- something about architecture/modularity specific to Prysm? anything that we do which is unorthotox?
- custom types? maybe later, after the feature is complete?
- use higher-order pipelines (e.g. https://github.com/prysmaticlabs/prysm/pull/)? maybe after https://github.com/prysmaticlabs/prysm/pull/8297 gest merged so that we have more than 1 pipeline?
- something more about errors/logs? we might have something related to errors after the error handling revamp feature
- something more about testing?
- how to break all of this into sections?