-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (30 loc) · 1.02 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"github.com/dimau/Uni/pkg/appSourceCodeCreator"
"github.com/dimau/Uni/pkg/domainDescriptionParser"
"io/ioutil"
"log"
"os"
)
func main() {
// Read marshalled text of JSON Domain Description from the file
file, err := os.Open("./resultApplication/textDomainDescription.json")
if err != nil {
log.Fatalln("Can't open text file with JSON domain description " + err.Error())
}
// Closing file after all read operations done
defer func() {
if err := file.Close(); err != nil {
log.Fatalln(err.Error())
}
}()
// Reading file with domain description
data, err := ioutil.ReadAll(file)
if err != nil {
log.Fatalln("Can't read from text file with JSON domain description " + err.Error())
}
// Handle JSON domain description and make a source code for an Application
jsonDomainDescription := domainDescriptionParser.ParseJsonDomainDescription(data)
sourceFileContent := appSourceCodeCreator.CreateAppSourceCode(jsonDomainDescription)
appSourceCodeCreator.PrintAppSourceCodeToFile(sourceFileContent)
}