Skip to content

Commit

Permalink
add goapp
Browse files Browse the repository at this point in the history
  • Loading branch information
techfg committed Feb 2, 2025
1 parent 6aa5735 commit 5d0fc0f
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 2 deletions.
3 changes: 3 additions & 0 deletions apps/goapp/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module apps/goapp

go 1.23
12 changes: 12 additions & 0 deletions apps/goapp/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import "fmt"

func Hello(name string) string {
result := "Hello " + name
return result
}

func main() {
fmt.Println(Hello("apps/goapp"))
}
12 changes: 12 additions & 0 deletions apps/goapp/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"testing"
)

func TestHello(t *testing.T) {
result := Hello("world")
if result != "Hello world" {
t.Error("Expected Hello to append 'world'")
}
}
30 changes: 30 additions & 0 deletions apps/goapp/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "apps/goapp",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/goapp",
"tags": [],
"targets": {
"build": {
"executor": "@nx-go/nx-go:build",
"options": {
"main": "{projectRoot}/main.go"
}
},
"serve": {
"executor": "@nx-go/nx-go:serve",
"options": {
"main": "{projectRoot}/main.go"
}
},
"test": {
"executor": "@nx-go/nx-go:test"
},
"lint": {
"executor": "@nx-go/nx-go:lint"
},
"tidy": {
"executor": "@nx-go/nx-go:tidy"
}
}
}
3 changes: 3 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go 1.23

use ./apps/goapp
6 changes: 4 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"!{projectRoot}/src/test-setup.[jt]s"
],
"sharedGlobals": [
"{workspaceRoot}/.github/workflows/ci.yml"
"{workspaceRoot}/.github/workflows/ci.yml",
"{workspaceRoot}/go.work"
]
},
"nxCloudId": "679f1d7394816d7ba46bf56e",
Expand Down Expand Up @@ -44,7 +45,8 @@
"buildDepsTargetName": "build-deps",
"watchDepsTargetName": "watch-deps"
}
}
},
"@nx-go/nx-go"
],
"generators": {
"@nx/react": {
Expand Down
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {},
"private": true,
"devDependencies": {
"@nx-go/nx-go": "^3.3.1",
"@nx/js": "20.4.0",
"@nx/react": "^20.4.0",
"@nx/vite": "20.4.0",
Expand Down

0 comments on commit 5d0fc0f

Please sign in to comment.