-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring project structure #9
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
/* | ||
This function fetches airport data from a remote CSV file via HTTP and returns it to the application. It is designed | ||
for reuse throughout the application. | ||
*/ | ||
Comment on lines
+1
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment block provides a good overview of the purpose of the |
||
package main | ||
|
||
import ( | ||
Comment on lines
+1
to
7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The
The error message "failed to get airports.csv" is repeated. It would be better to define this as a constant or to use a more descriptive message in each case to differentiate between the error of the HTTP GET request and the error of an unsatisfactory status code.
The check for
Error handling is missing if the SDK initialization fails. The application should log the error and exit with a non-zero status code to indicate failure. if err != nil {
+ log.Fatalf("Failed to initialize Tarmac SDK: %v", err)
- return
} |
||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,10 @@ | ||||||||
/* | ||||||||
The purpose of this function is to download the CSV data (by calling another function), parse it, enrich the data, and | ||||||||
load the contents within the SQL database. | ||||||||
|
||||||||
This function is called multiple times throughout the application. It's called by an "init" function and also set | ||||||||
as a scheduled task by itself. | ||||||||
*/ | ||||||||
package main | ||||||||
|
||||||||
import ( | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Syntax error in the import block. import (
+ ) Commitable suggestion
Suggested change
|
||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.PHONY: tests | ||
tests: | ||
go test -v -race ./... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module github.com/tarmac-project/example-airport-lookup-go/functions/src/handlers/lookup | ||
|
||
go 1.21 | ||
|
||
require ( | ||
github.com/tarmac-project/tarmac/pkg/sdk v0.5.0 | ||
github.com/valyala/fastjson v1.6.4 | ||
) | ||
|
||
require github.com/wapc/wapc-guest-tinygo v0.3.3 // indirect |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
mkdir
command for thecoverage
directory should be checked to avoid unnecessary directory creation if it already exists.Commitable suggestion