Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0187d4031c | |||
| e5aced29a3 | |||
| 8605f39f53 | |||
| aa601454fd | |||
| 90bf0bcb73 | |||
| 2c70f0660e | |||
| 9f85187b21 | |||
| 4df3116475 | |||
| 42bbe1fa21 | |||
| 7fc73921d3 | |||
| e8d042b65e | |||
| 853bee22db |
@@ -1,5 +1,5 @@
|
|||||||
name: Fibonacci unit tests
|
name: Fibonacci container test
|
||||||
run-name: ${{ gitea.actor }} is testing Fibonacci
|
run-name: ${{ gitea.actor }} is testing Fibonacci containerization
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -18,5 +18,6 @@ jobs:
|
|||||||
go-version: '1.24.4'
|
go-version: '1.24.4'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Containerize app
|
- name: Containerize app
|
||||||
run: exit 0
|
run: |
|
||||||
|
echo "Still needs to be implemented."
|
||||||
|
exit 1
|
||||||
|
|||||||
@@ -18,5 +18,7 @@ jobs:
|
|||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Test functions module
|
- name: Test functions module
|
||||||
run: go test ./functions -v
|
run: go test ./functions -v
|
||||||
|
working-directory: ./code
|
||||||
- name: Test actual build
|
- name: Test actual build
|
||||||
run: go build
|
run: go build
|
||||||
|
working-directory: ./code
|
||||||
|
|||||||
25
.gitignore
vendored
25
.gitignore
vendored
@@ -1,26 +1,3 @@
|
|||||||
# Allowlisting gitignore template for GO projects prevents us
|
|
||||||
# from adding various unwanted local files, such as generated
|
|
||||||
# files, developer configurations or IDE-specific files etc.
|
|
||||||
#
|
|
||||||
# Recommended: Go.AllowList.gitignore
|
|
||||||
|
|
||||||
# Ignore everything
|
|
||||||
*
|
|
||||||
|
|
||||||
.env
|
.env
|
||||||
# But not these files...
|
.swp
|
||||||
!/.gitignore
|
|
||||||
|
|
||||||
!*.go
|
|
||||||
!go.sum
|
|
||||||
!go.mod
|
|
||||||
|
|
||||||
!README.md
|
|
||||||
!LICENSE
|
|
||||||
|
|
||||||
# !Makefile
|
|
||||||
|
|
||||||
# ...even if they are in subdirectories
|
|
||||||
!*/
|
|
||||||
!.gitea/*
|
|
||||||
!.gitea/workflows/*
|
|
||||||
|
|||||||
17
code/.gitignore
vendored
Normal file
17
code/.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Allowlisting gitignore template for GO projects prevents us
|
||||||
|
# from adding various unwanted local files, such as generated
|
||||||
|
# files, developer configurations or IDE-specific files etc.
|
||||||
|
#
|
||||||
|
# Recommended: Go.AllowList.gitignore
|
||||||
|
|
||||||
|
# Ignore everything
|
||||||
|
*
|
||||||
|
|
||||||
|
.env
|
||||||
|
# But not these files...
|
||||||
|
!/.gitignore
|
||||||
|
|
||||||
|
!functions/*.go
|
||||||
|
!*.go
|
||||||
|
!go.sum
|
||||||
|
!go.mod
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package functions
|
package functions
|
||||||
|
|
||||||
import(
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ func MyFibonacci(count int) (fibonaccivalue int, error error) {
|
|||||||
var prev_fibonacci int = 0
|
var prev_fibonacci int = 0
|
||||||
|
|
||||||
if count < 1 {
|
if count < 1 {
|
||||||
return -1, errors.New(fmt.Sprintf("%d is not a positive integer.",count))
|
return -1, fmt.Errorf("%d is not a positive integer", count)
|
||||||
}
|
}
|
||||||
for i := 1; i < count; i++ {
|
for i := 1; i < count; i++ {
|
||||||
fibonaccivalue += prev_fibonacci
|
fibonaccivalue += prev_fibonacci
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
module darjeeling.systemec.nl/rhouben/fibonacci
|
module darjeeling.systemec.nl/rhouben/fibonacci
|
||||||
|
replace darjeeling.systemec.nl/rhouben/fibonacci/functions => ./functions
|
||||||
|
|
||||||
go 1.24.4
|
go 1.24.4
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"flag"
|
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
port_arg := os.Getenv("FIB_PORT")
|
port_arg := os.Getenv("FIB_PORT")
|
||||||
if port_arg != "" {
|
if port_arg != "" {
|
||||||
fmt.Printf("Loaded port value '%s' from environment.\n",port_arg)
|
fmt.Printf("Loaded port value '%s' from environment.\n", port_arg)
|
||||||
port_number, error = strconv.Atoi(port_arg)
|
port_number, error = strconv.Atoi(port_arg)
|
||||||
if error != nil {
|
if error != nil {
|
||||||
fmt.Printf("I had an error trying to parse '%s' into a number: %s\n",
|
fmt.Printf("I had an error trying to parse '%s' into a number: %s\n",
|
||||||
19
docker/Dockerfile
Normal file
19
docker/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
FROM golang:1.24-bookworm AS base
|
||||||
|
|
||||||
|
# /build is the working directory
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
# Copy control files and pull in dependencies
|
||||||
|
COPY code/ ./
|
||||||
|
RUN go mod tidy \
|
||||||
|
&& go mod download
|
||||||
|
|
||||||
|
ENV port=8089
|
||||||
|
|
||||||
|
# Build the app
|
||||||
|
|
||||||
|
RUN go build -o fibonacci
|
||||||
|
|
||||||
|
EXPOSE ${port}
|
||||||
|
|
||||||
|
CMD ["build/fibonacci"]
|
||||||
39
openpgp-policy.toml
Normal file
39
openpgp-policy.toml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
version = 0
|
||||||
|
commit_goodlist = []
|
||||||
|
|
||||||
|
[authorization."Rens Houben <lpmhouben@gmail.com>"]
|
||||||
|
sign_commit = true
|
||||||
|
sign_tag = true
|
||||||
|
sign_archive = true
|
||||||
|
add_user = true
|
||||||
|
retire_user = true
|
||||||
|
audit = true
|
||||||
|
keyring = """
|
||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
Comment: E440 6FB1 B3DE 72FC BB5A 31B6 B9BD 7068 7972 7348 DF96 C300 16E9 1615 C1CA 3244
|
||||||
|
Comment: <lpmhouben@gmail.com>
|
||||||
|
Comment: Rens Houben
|
||||||
|
|
||||||
|
xioGaJm15RsAAAAgaN/rppCWy2CMp+ptpgSv+PdNrRto2adth6QmlOwgZoPCrAYf
|
||||||
|
GwoAAAA9BYJombXlBYkFpI+9AwsJBwMVCggCmwECHgkiIQbkQG+xs95y/LtaMba5
|
||||||
|
vXBoeXJzSN+WwwAW6RYVwcoyRAAAAABf0iCRI80vGSLlZ05nqtSy1X9tkRrt9ZXH
|
||||||
|
F5RZlDdGUF00mfPBZnIYcHyNu7KQpfz5XS8O7vC27fDjx0EgY6s9b0Y5GPmTZEpk
|
||||||
|
jIs2ijl5teaaiwPPh6ow5Kg57v92EOFEUAfNFTxscG1ob3ViZW5AZ21haWwuY29t
|
||||||
|
PsKsBhMbCgAAAD0FgmiZteUFiQWkj70DCwkHAxUKCAKbAQIeCSIhBuRAb7Gz3nL8
|
||||||
|
u1oxtrm9cGh5cnNI35bDABbpFhXByjJEAAAAAJHaIFARgIT42hWyM6UPxr42sPKd
|
||||||
|
jlPALYaYHOYuVtDbb/CHA4LBgfwmSGdRimrf9Sq3+rAmb5JSLipYcd3mnrWBIjqc
|
||||||
|
wpdz0ClJC01ZzT9Rw4pnOoZueH90ApxVjOjPd0PBAc0LUmVucyBIb3ViZW7CrwYT
|
||||||
|
GwoAAABABYJombXlBYkFpI+9AwsJBwMVCggCmQECmwECHgkiIQbkQG+xs95y/Lta
|
||||||
|
Mba5vXBoeXJzSN+WwwAW6RYVwcoyRAAAAABhmSDBodFpCvgrvmxI5gPOArSU3BDX
|
||||||
|
4WXqK8uN08ppnKjno6jWPwVMh4mtQZZhVIuZnNvIpnb4fZIa3npwBVFGw/fK6phj
|
||||||
|
0TS9vSh2U9WKL1CE21dsSl16FqpA1qiJ7EyArQrOKgZombXlGwAAACAh7EFlctzR
|
||||||
|
Hn/V4RlbrHBt0nJcPjZPE8kg45MBPLu408LAewYYGwoAAADMBYJombXlBYkFpI+9
|
||||||
|
ApsCmaAGGRsKAAAAKQWCaJm15SIhBtz66d8XPr0tPfjKlTJSSk/BlB82V2PMYb4x
|
||||||
|
rFo3auRxAAAAAOQxIII9+VkI23cNclHhcwYDjNm7VdQpyfQMpX4dFTsHr60ERqHz
|
||||||
|
LGvExM6iFiB85hy7D82H7HPOI9LDbfMdjlhfZQbC1ZmzBVqyJE2DwQQqdm4JDlGJ
|
||||||
|
T8M4wf9JN7JJ0VRKAiIhBuRAb7Gz3nL8u1oxtrm9cGh5cnNI35bDABbpFhXByjJE
|
||||||
|
AAAAAMqZIGLwh64mdeHOsLRPaB3UvyXonaaSnr2XqunoiOdPVT1u4Kgg7MaKggxk
|
||||||
|
RPis16dnrwiKgBh7AMT4l22ZDlGE5FJcYu0PT5YAsLQrdJAw4+HCdga0sd2vefUT
|
||||||
|
SsuNjA9rDw==
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
|
"""
|
||||||
Reference in New Issue
Block a user