initial commit

main
Antonio De Lucreziis 2 years ago
commit c1b04de8ea

@ -0,0 +1,9 @@
kind: pipeline
name: default
steps:
- name: test
image: golang
commands:
- go test -v ./...
- go build

11
.gitignore vendored

@ -0,0 +1,11 @@
.env
*.local*
node_modules/
bin/
.out/
out/
dist/
.vscode/

@ -0,0 +1,4 @@
# Drone Example
Un piccolo progetto di esempio per mostrare come funziona [Drone](https://build.phc.dm.unipi.it)

Binary file not shown.

@ -0,0 +1,5 @@
package foo
func Sum(a, b int) int {
return a + b
}

@ -0,0 +1,12 @@
package foo_test
import (
"testing"
"git.phc.dm.unipi.it/phc/drone-example/foo"
"github.com/alecthomas/assert/v2"
)
func TestFoo(t *testing.T) {
assert.Equal(t, 111, foo.Sum(42, 69))
}

@ -0,0 +1,9 @@
module git.phc.dm.unipi.it/phc/drone-example
go 1.19
require (
github.com/alecthomas/assert/v2 v2.2.1 // indirect
github.com/alecthomas/repr v0.2.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
)

@ -0,0 +1,6 @@
github.com/alecthomas/assert/v2 v2.2.1 h1:XivOgYcduV98QCahG8T5XTezV5bylXe+lBxLG2K2ink=
github.com/alecthomas/assert/v2 v2.2.1/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ=
github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk=
github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=

@ -0,0 +1,24 @@
package main
import (
"fmt"
"log"
"git.phc.dm.unipi.it/phc/drone-example/foo"
)
func main() {
var a, b int
fmt.Printf("a = ")
if _, err := fmt.Scanln("%d", &a); err != nil {
log.Fatal(err)
}
fmt.Printf("b = ")
if _, err := fmt.Scanln("%d", &b); err != nil {
log.Fatal(err)
}
result := foo.Sum(a, b)
log.Printf("a + b = %v", result)
}
Loading…
Cancel
Save