Skip to content

Commit 0bb14df

Browse files
committed
docs: updated multiple doc comments
1 parent 2023901 commit 0bb14df

File tree

6 files changed

+22
-21
lines changed

6 files changed

+22
-21
lines changed

.github/dependabot.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ updates:
1313

1414
- package-ecosystem: github-actions
1515
directory: "/"
16-
schedule:
17-
interval: weekly
18-
day: "monday"
19-
time: "06:00" # 9 am in romania
20-
commit-message:
21-
prefix: "build(deps)"
22-
reviewers:
23-
- "adrianbrad"
24-
25-
- package-ecosystem: docker
26-
directory: "/d8t"
2716
schedule:
2817
interval: weekly
2918
day: "monday"

.github/workflows/codeql.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
name: "CodeQL"
1+
name: codeql
72

83
on:
94
push:
@@ -34,6 +29,7 @@ jobs:
3429
uses: github/codeql-action/init@v2
3530
with:
3631
languages: go
32+
3733
- name: Autobuild
3834
uses: github/codeql-action/autobuild@v2
3935

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lint:
22
golangci-lint run --fix
33

44
test:
5-
go test -mod=mod -shuffle=on --race .
5+
go test -mod=mod -shuffle=on -race .
66

77
test-ci:
8-
go test -mod=mod -shuffle=on -count=1 -timeout 60s -coverprofile=coverage.txt -covermode=atomic .
8+
go test -mod=mod -shuffle=on -race -timeout 60s -coverprofile=coverage.txt -covermode=atomic .

circular.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ var _ Queue[any] = (*Circular[any])(nil)
1010
// Circular is a Queue implementation.
1111
// A circular queue is a queue that uses a fixed-size slice as if it were connected end-to-end.
1212
// When the queue is full, adding a new element to the queue overwrites the oldest element.
13+
//
14+
// Example:
15+
// We have the following queue with a capacity of 3 elements: [1, 2, 3].
16+
// If the tail of the queue is set to 0, as if we just added the element `3`,
17+
// then the next element to be added to the queue will overwrite the element at index 0.
18+
// So, if we add the element `4`, the queue will look like this: [4, 2, 3].
19+
// If the head of the queue is set to 0, as if we never removed an element yet,
20+
// then the next element to be removed from the queue will be the element at index 0, which is `4`.
1321
type Circular[T comparable] struct {
1422
initialElements []T
1523
elems []T
@@ -206,7 +214,7 @@ func (q *Circular[T]) Size() int {
206214

207215
// ===================================Helpers==================================
208216

209-
// Get returns the element at the head of the queue.
217+
// get returns the element at the head of the queue.
210218
func (q *Circular[T]) get() (v T, _ error) {
211219
if q.isEmpty() {
212220
return v, ErrNoElementsAvailable
@@ -219,6 +227,7 @@ func (q *Circular[T]) get() (v T, _ error) {
219227
return item, nil
220228
}
221229

230+
// isEmpty returns true if the queue is empty.
222231
func (q *Circular[T]) isEmpty() bool {
223232
return q.size == 0
224233
}

doc.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@
88
// A priority queue based on a container.Heap. The elements in the queue
99
// must implement the Lesser interface, and are ordered based on the
1010
// Less method. The head of the queue is always the highest priority element.
11+
//
12+
// A circular queue, which is a queue that uses a fixed-size slice as
13+
// if it were connected end-to-end. When the queue is full, adding a new element to the queue
14+
// overwrites the oldest element.
1115
package queue

queue_interface.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package queue
22

3-
// Queue is a collection that orders elements in a FIFO order.
3+
// A Queue is an ordered sequence of items, the order is usually first in first out.
4+
// New items are added to the back of the queue and
5+
// existing items are removed from the front of the queue.
6+
//
47
// This interface provides basic methods for adding and extracting elements
58
// from the queue.
69
// Items are extracted from the head of the queue and added to the tail

0 commit comments

Comments
 (0)