SlideShare a Scribd company logo
GOLang
& GoatCore
Dlaczego powstał?
Jak zacząć
Krok 1
● Zainstaluj mingw64
● C_INCLUDE_PATH
● PATH
C:Program Filesmingw-w64x86_64-6.3.0-posix-seh-rt_v5-rev1mingw64include
C:Program Filesmingw-w64x86_64-6.3.0-posix-seh-rt_v5-rev1mingw64libgccmingw324.5.1include
C:Program Filesmingw-w64x86_64-6.3.0-posix-seh-rt_v5-rev1mingw64bin
C:Program Filesmingw-w64x86_64-6.3.0-posix-seh-rt_v5-rev1mingw64libexecgccx86_64-w64-mingw326.2.0
Krok 2
● Zainstaluj golang
● Zainstaluj git
● Zainstaluj atom
● Zainstaluj go-plus plugin (do atoma)
● Zainstaluj postgresa (lub inną bazę w zależności od projektu)
● Zainstaluj delve
● Zainstaluj npm, yarn...
Krok 3
● Zainstaluj biblioteki dla atoma
> go get -u golang.org/x/tools/cmd/goimports
> go get -u golang.org/x/tools/cmd/gorename
> go get -u github.com/sqs/goreturns
> go get -u github.com/nsf/gocode
> go get -u github.com/alecthomas/gometalinter
> go get -u github.com/zmb3/gogetdoc
> go get -u github.com/rogpeppe/godef
> go get -u golang.org/x/tools/cmd/guru
Krok 4
● Pobieramy projekt
> git clone github.com/goatcms/goatcore
> git clone github.com/goatcms/goatcms
Krok 5
● Pobieramy projekt
> cd github.com/goatcms/goatcms
> go run ./main.go run --loglvl=dev
Jak zacząć szybciej
Pobieramy i odpalamy
● Pobieramy github.com/goatcms/goatcms/devops/devtools
● Odpalamy
> docker-compose up
> git clone https://github.com/goatcms/goatcms.git
Czas na demo
Budowanie
Pobieramy i odpalamy
● Odpalamy
● Budujemy #1
> go build .main.go
> go run ./main.go run --loglvl=dev
Pobieramy i odpalamy
● Budujemy #2
● Budujemy #3
> GOARM=6 GOARCH=arm GOOS=linux go build examples/raspi_blink.go
> go build -ldflags "-w" .main.go
Dlaczego go jest odjechany
“Concurrency Is Not Parallelism”
- Rob Pike
Kanały
package main
import "fmt"
func main() {
ch := make(chan int, 2)
ch <- 1
ch <- 2
fmt.Println(<-ch)
fmt.Println(<-ch)
}
Kanał & runtime
func fibonacci(n int, c chan int) {
x, y := 0, 1
for i := 0; i < n; i++ {
c <- x
x, y = y, x+y
}
close(c)
}
func main() {
c := make(chan int, 10)
go fibonacci(cap(c), c)
for i := range c {
fmt.Println(i)
}
}
Select
func main() {
tick := time.Tick(100 * time.Millisecond)
boom := time.After(500 * time.Millisecond)
for {
select {
case <-tick:
fmt.Println("tick.")
case <-boom:
fmt.Println("BOOM!")
return
default:
fmt.Println(" .")
time.Sleep(50 * time.Millisecond)
}
}
}
GoatCore
… iteracja po plikach
fsloop.NewLoop(&fsloop.LoopData{
Filespace: fs,
FileFilter: func(fs filesystem.Filespace, subPath string) bool {
return strings.HasSuffix(subPath, ".json")
},
OnFile: func(fs filesystem.Filespace, subPath string) error {
data, err := fs.ReadFile(subPath)
if err != nil {
return err
}
tmap := map[string]string{}
if err = LoadJSON("", tmap, data); err != nil {
return err
}
i18.Set(tmap)
return nil
},
}, scope).Run(basePath)
… iteracja po plikach
func LoadJSON(resultKey string, result map[string]string, data []byte) error {
return jsonparser.ObjectEach(data, func(key []byte, value []byte,
dataType jsonparser.ValueType, offset int) error {
var newResultKey string
if resultKey != "" {
newResultKey = resultKey + "." + string(key)
} else {
newResultKey = string(key)
}
switch dataType {
case jsonparser.Object:
return LoadJSON(newResultKey, result, value)
case jsonparser.String:
result[newResultKey] = string(value)
}
return nil
})
}
What makes it so fast?
● It does not rely on encoding/json, reflection or interface{}, the only real
package dependency is bytes.
● Operates with JSON payload on byte level, providing you pointers to the
original data structure: no memory allocation.
● No automatic type conversions, by default everything is a []byte, but it
provides you value type, so you can convert by yourself (there is few
helpers included).
● Does not parse full record, only keys you specified
- buger/jsonparser
Testujemy
● Testy jednostkowe
● Testy wydajnościowe
> go test -v github.com/goatcms/goatcore/...
> cd github.com/goatcms/goatcore/i18n/fsi18loader
> go test --bench=Linear --cpu=1,2,3,4,5,6,7,8,9,10
Pytania?
GoatCore
https://github.com/goatcms/goatcore
Dziękuję za uwagę

More Related Content

What's hot

Scaling FastAGI Applications with Go
Scaling FastAGI Applications with GoScaling FastAGI Applications with Go
Scaling FastAGI Applications with Go
Digium
 
Basic command for linux
Basic command for linuxBasic command for linux
Basic command for linuxgt0ne
 
Commit2015 kharchenko - python generators - ext
Commit2015   kharchenko - python generators - extCommit2015   kharchenko - python generators - ext
Commit2015 kharchenko - python generators - ext
Maxym Kharchenko
 
Go memory
Go memoryGo memory
Go memory
jgrahamc
 
[JAM 1.2] Design & Multitasking (Andrew Solovey)
[JAM 1.2] Design & Multitasking (Andrew Solovey)[JAM 1.2] Design & Multitasking (Andrew Solovey)
[JAM 1.2] Design & Multitasking (Andrew Solovey)Evgeny Kaziak
 
Deep Learning for Developers
Deep Learning for DevelopersDeep Learning for Developers
Deep Learning for Developers
Amazon Web Services
 
nouka inventry manager
nouka inventry managernouka inventry manager
nouka inventry manager
Toshiaki Baba
 
Building a DSL with GraalVM (CodeOne)
Building a DSL with GraalVM (CodeOne)Building a DSL with GraalVM (CodeOne)
Building a DSL with GraalVM (CodeOne)
Maarten Mulders
 
3 rd animation
3 rd animation3 rd animation
3 rd animation
divyalakshmi77
 
Go破壊
Go破壊Go破壊
Go破壊
Hattori Hideo
 
Sup intro
Sup introSup intro
Sup intro
chase pettet
 
Clojure + MongoDB on Heroku
Clojure + MongoDB on HerokuClojure + MongoDB on Heroku
Clojure + MongoDB on Heroku
Naoyuki Kakuda
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
jgrahamc
 
Containers for sysadmins
Containers for sysadminsContainers for sysadmins
Containers for sysadmins
Carlos de Alfonso Laguna
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
Alexander Kachur
 
Tests unitaires pour PostgreSQL avec pgTap
Tests unitaires pour PostgreSQL avec pgTapTests unitaires pour PostgreSQL avec pgTap
Tests unitaires pour PostgreSQL avec pgTap
Rodolphe Quiédeville
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Cloudflare
 
Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話
dcubeio
 
KubeCon EU 2016: Custom Volume Plugins
KubeCon EU 2016: Custom Volume PluginsKubeCon EU 2016: Custom Volume Plugins
KubeCon EU 2016: Custom Volume Plugins
KubeAcademy
 

What's hot (20)

Scaling FastAGI Applications with Go
Scaling FastAGI Applications with GoScaling FastAGI Applications with Go
Scaling FastAGI Applications with Go
 
Basic command for linux
Basic command for linuxBasic command for linux
Basic command for linux
 
Commit2015 kharchenko - python generators - ext
Commit2015   kharchenko - python generators - extCommit2015   kharchenko - python generators - ext
Commit2015 kharchenko - python generators - ext
 
Go memory
Go memoryGo memory
Go memory
 
[JAM 1.2] Design & Multitasking (Andrew Solovey)
[JAM 1.2] Design & Multitasking (Andrew Solovey)[JAM 1.2] Design & Multitasking (Andrew Solovey)
[JAM 1.2] Design & Multitasking (Andrew Solovey)
 
Deep Learning for Developers
Deep Learning for DevelopersDeep Learning for Developers
Deep Learning for Developers
 
nouka inventry manager
nouka inventry managernouka inventry manager
nouka inventry manager
 
Building a DSL with GraalVM (CodeOne)
Building a DSL with GraalVM (CodeOne)Building a DSL with GraalVM (CodeOne)
Building a DSL with GraalVM (CodeOne)
 
3 rd animation
3 rd animation3 rd animation
3 rd animation
 
Go破壊
Go破壊Go破壊
Go破壊
 
Sup intro
Sup introSup intro
Sup intro
 
Go Memory
Go MemoryGo Memory
Go Memory
 
Clojure + MongoDB on Heroku
Clojure + MongoDB on HerokuClojure + MongoDB on Heroku
Clojure + MongoDB on Heroku
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
 
Containers for sysadmins
Containers for sysadminsContainers for sysadmins
Containers for sysadmins
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
 
Tests unitaires pour PostgreSQL avec pgTap
Tests unitaires pour PostgreSQL avec pgTapTests unitaires pour PostgreSQL avec pgTap
Tests unitaires pour PostgreSQL avec pgTap
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming
 
Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話
 
KubeCon EU 2016: Custom Volume Plugins
KubeCon EU 2016: Custom Volume PluginsKubeCon EU 2016: Custom Volume Plugins
KubeCon EU 2016: Custom Volume Plugins
 

Viewers also liked

Angular2 - Co jest grane?!?!
Angular2 - Co jest grane?!?! Angular2 - Co jest grane?!?!
Angular2 - Co jest grane?!?!
Sebastian Pożoga
 
Go dla elektronika
Go dla elektronikaGo dla elektronika
Go dla elektronika
Sebastian Pożoga
 
Angular2 - In Action
Angular2  - In ActionAngular2  - In Action
Angular2 - In Action
Sebastian Pożoga
 
Fosdem i inne konferencje
Fosdem i inne konferencjeFosdem i inne konferencje
Fosdem i inne konferencje
Sebastian Pożoga
 
IoT dla programistów
IoT dla programistówIoT dla programistów
IoT dla programistów
Sebastian Pożoga
 
Overview of AngularJS
Overview of AngularJS Overview of AngularJS
Overview of AngularJS
Sebastian Pożoga
 
Moxi - Memcached Proxy
Moxi - Memcached ProxyMoxi - Memcached Proxy
Moxi - Memcached Proxy
NorthScale
 
Connected home - market evolution & protocol wars
Connected home - market evolution & protocol warsConnected home - market evolution & protocol wars
Connected home - market evolution & protocol wars
Borys Tomala
 
HTTP/2 in Examples
HTTP/2 in ExamplesHTTP/2 in Examples
HTTP/2 in Examples
Mihail Stoynov
 
Distributed Hash Table and Consistent Hashing
Distributed Hash Table and Consistent HashingDistributed Hash Table and Consistent Hashing
Distributed Hash Table and Consistent Hashing
CloudFundoo
 

Viewers also liked (10)

Angular2 - Co jest grane?!?!
Angular2 - Co jest grane?!?! Angular2 - Co jest grane?!?!
Angular2 - Co jest grane?!?!
 
Go dla elektronika
Go dla elektronikaGo dla elektronika
Go dla elektronika
 
Angular2 - In Action
Angular2  - In ActionAngular2  - In Action
Angular2 - In Action
 
Fosdem i inne konferencje
Fosdem i inne konferencjeFosdem i inne konferencje
Fosdem i inne konferencje
 
IoT dla programistów
IoT dla programistówIoT dla programistów
IoT dla programistów
 
Overview of AngularJS
Overview of AngularJS Overview of AngularJS
Overview of AngularJS
 
Moxi - Memcached Proxy
Moxi - Memcached ProxyMoxi - Memcached Proxy
Moxi - Memcached Proxy
 
Connected home - market evolution & protocol wars
Connected home - market evolution & protocol warsConnected home - market evolution & protocol wars
Connected home - market evolution & protocol wars
 
HTTP/2 in Examples
HTTP/2 in ExamplesHTTP/2 in Examples
HTTP/2 in Examples
 
Distributed Hash Table and Consistent Hashing
Distributed Hash Table and Consistent HashingDistributed Hash Table and Consistent Hashing
Distributed Hash Table and Consistent Hashing
 

Similar to GoLang & GoatCore

Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Badoo Development
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
julien pauli
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performance
source{d}
 
Python 3
Python 3Python 3
Python 3
Andrews Medina
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 
Writing Faster Python 3
Writing Faster Python 3Writing Faster Python 3
Writing Faster Python 3
Sebastian Witowski
 
Python 3 - tutorial
Python 3 - tutorialPython 3 - tutorial
Python 3 - tutorial
Andrews Medina
 
Source Plugins
Source PluginsSource Plugins
Source Plugins
Matthew Pickering
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
Geeks Anonymes
 
Linux Tracing Superpowers by Eugene Pirogov
Linux Tracing Superpowers by Eugene PirogovLinux Tracing Superpowers by Eugene Pirogov
Linux Tracing Superpowers by Eugene Pirogov
Pivorak MeetUp
 
Using Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutions
Sander van der Burg
 
The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5.1 book - Part 44 of 180The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5.1 book - Part 44 of 180
Mahmoud Samir Fayed
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
 
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Modern Data Stack France
 
Using Puppet to Create a Dynamic Network - PuppetConf 2013
Using Puppet to Create a Dynamic Network - PuppetConf 2013Using Puppet to Create a Dynamic Network - PuppetConf 2013
Using Puppet to Create a Dynamic Network - PuppetConf 2013
Puppet
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Mark Wong
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLCommand Prompt., Inc
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
Robert Stern
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
Henry Schreiner
 

Similar to GoLang & GoatCore (20)

Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performance
 
Python 3
Python 3Python 3
Python 3
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
Writing Faster Python 3
Writing Faster Python 3Writing Faster Python 3
Writing Faster Python 3
 
Python 3 - tutorial
Python 3 - tutorialPython 3 - tutorial
Python 3 - tutorial
 
Source Plugins
Source PluginsSource Plugins
Source Plugins
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
 
Linux Tracing Superpowers by Eugene Pirogov
Linux Tracing Superpowers by Eugene PirogovLinux Tracing Superpowers by Eugene Pirogov
Linux Tracing Superpowers by Eugene Pirogov
 
Using Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutions
 
The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5.1 book - Part 44 of 180The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5.1 book - Part 44 of 180
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
 
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
Hadoop meetup : HUGFR Construire le cluster le plus rapide pour l'analyse des...
 
Using Puppet to Create a Dynamic Network - PuppetConf 2013
Using Puppet to Create a Dynamic Network - PuppetConf 2013Using Puppet to Create a Dynamic Network - PuppetConf 2013
Using Puppet to Create a Dynamic Network - PuppetConf 2013
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 

More from Sebastian Pożoga

Hardgroup - Raspberry PI #1
Hardgroup - Raspberry PI #1Hardgroup - Raspberry PI #1
Hardgroup - Raspberry PI #1
Sebastian Pożoga
 
Sails.js - Overview
Sails.js - OverviewSails.js - Overview
Sails.js - Overview
Sebastian Pożoga
 
3D Printing
3D Printing3D Printing
3D Printing
Sebastian Pożoga
 
Meet.php #gpio
Meet.php #gpioMeet.php #gpio
Meet.php #gpio
Sebastian Pożoga
 
Game jump frontend introduction #workshop1
Game jump  frontend introduction #workshop1Game jump  frontend introduction #workshop1
Game jump frontend introduction #workshop1
Sebastian Pożoga
 
Game jump: frontend introduction #1
Game jump: frontend introduction #1Game jump: frontend introduction #1
Game jump: frontend introduction #1
Sebastian Pożoga
 
The future of technologies
The future of technologiesThe future of technologies
The future of technologies
Sebastian Pożoga
 
Poznań 4.04.2013
Poznań 4.04.2013Poznań 4.04.2013
Poznań 4.04.2013
Sebastian Pożoga
 
Programming style
Programming styleProgramming style
Programming style
Sebastian Pożoga
 
Blender3 d
Blender3 dBlender3 d
Blender3 d
Sebastian Pożoga
 
Events Poznań 18.01.2013
Events Poznań 18.01.2013Events Poznań 18.01.2013
Events Poznań 18.01.2013
Sebastian Pożoga
 

More from Sebastian Pożoga (15)

Hardgroup - Raspberry PI #1
Hardgroup - Raspberry PI #1Hardgroup - Raspberry PI #1
Hardgroup - Raspberry PI #1
 
Sails.js - Overview
Sails.js - OverviewSails.js - Overview
Sails.js - Overview
 
3D Printing
3D Printing3D Printing
3D Printing
 
Meet.php #gpio
Meet.php #gpioMeet.php #gpio
Meet.php #gpio
 
OSFile#2
OSFile#2OSFile#2
OSFile#2
 
Game jump frontend introduction #workshop1
Game jump  frontend introduction #workshop1Game jump  frontend introduction #workshop1
Game jump frontend introduction #workshop1
 
Game jump: frontend introduction #1
Game jump: frontend introduction #1Game jump: frontend introduction #1
Game jump: frontend introduction #1
 
The future of technologies
The future of technologiesThe future of technologies
The future of technologies
 
OSFile
OSFileOSFile
OSFile
 
gameJUMP.pl#about
gameJUMP.pl#aboutgameJUMP.pl#about
gameJUMP.pl#about
 
Poznań 4.04.2013
Poznań 4.04.2013Poznań 4.04.2013
Poznań 4.04.2013
 
Programming style
Programming styleProgramming style
Programming style
 
Blender3 d
Blender3 dBlender3 d
Blender3 d
 
Events poznań 7.02.2013
Events poznań 7.02.2013Events poznań 7.02.2013
Events poznań 7.02.2013
 
Events Poznań 18.01.2013
Events Poznań 18.01.2013Events Poznań 18.01.2013
Events Poznań 18.01.2013
 

Recently uploaded

Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
IP ServerOne
 
Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
faizulhassanfaiz1670
 
Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
Vladimir Samoylov
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Sebastiano Panichella
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
Faculty of Medicine And Health Sciences
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
Sebastiano Panichella
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Access Innovations, Inc.
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
Access Innovations, Inc.
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Sebastiano Panichella
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
OWASP Beja
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
khadija278284
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
eCommerce Institute
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
Howard Spence
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Orkestra
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Matjaž Lipuš
 

Recently uploaded (16)

Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
 
Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
 
Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
 

GoLang & GoatCore

  • 3.
  • 4.
  • 5.
  • 6.
  • 8. Krok 1 ● Zainstaluj mingw64 ● C_INCLUDE_PATH ● PATH C:Program Filesmingw-w64x86_64-6.3.0-posix-seh-rt_v5-rev1mingw64include C:Program Filesmingw-w64x86_64-6.3.0-posix-seh-rt_v5-rev1mingw64libgccmingw324.5.1include C:Program Filesmingw-w64x86_64-6.3.0-posix-seh-rt_v5-rev1mingw64bin C:Program Filesmingw-w64x86_64-6.3.0-posix-seh-rt_v5-rev1mingw64libexecgccx86_64-w64-mingw326.2.0
  • 9. Krok 2 ● Zainstaluj golang ● Zainstaluj git ● Zainstaluj atom ● Zainstaluj go-plus plugin (do atoma) ● Zainstaluj postgresa (lub inną bazę w zależności od projektu) ● Zainstaluj delve ● Zainstaluj npm, yarn...
  • 10. Krok 3 ● Zainstaluj biblioteki dla atoma > go get -u golang.org/x/tools/cmd/goimports > go get -u golang.org/x/tools/cmd/gorename > go get -u github.com/sqs/goreturns > go get -u github.com/nsf/gocode > go get -u github.com/alecthomas/gometalinter > go get -u github.com/zmb3/gogetdoc > go get -u github.com/rogpeppe/godef > go get -u golang.org/x/tools/cmd/guru
  • 11. Krok 4 ● Pobieramy projekt > git clone github.com/goatcms/goatcore > git clone github.com/goatcms/goatcms
  • 12. Krok 5 ● Pobieramy projekt > cd github.com/goatcms/goatcms > go run ./main.go run --loglvl=dev
  • 14. Pobieramy i odpalamy ● Pobieramy github.com/goatcms/goatcms/devops/devtools ● Odpalamy > docker-compose up > git clone https://github.com/goatcms/goatcms.git
  • 17. Pobieramy i odpalamy ● Odpalamy ● Budujemy #1 > go build .main.go > go run ./main.go run --loglvl=dev
  • 18. Pobieramy i odpalamy ● Budujemy #2 ● Budujemy #3 > GOARM=6 GOARCH=arm GOOS=linux go build examples/raspi_blink.go > go build -ldflags "-w" .main.go
  • 19. Dlaczego go jest odjechany
  • 20. “Concurrency Is Not Parallelism” - Rob Pike
  • 21. Kanały package main import "fmt" func main() { ch := make(chan int, 2) ch <- 1 ch <- 2 fmt.Println(<-ch) fmt.Println(<-ch) }
  • 22. Kanał & runtime func fibonacci(n int, c chan int) { x, y := 0, 1 for i := 0; i < n; i++ { c <- x x, y = y, x+y } close(c) } func main() { c := make(chan int, 10) go fibonacci(cap(c), c) for i := range c { fmt.Println(i) } }
  • 23. Select func main() { tick := time.Tick(100 * time.Millisecond) boom := time.After(500 * time.Millisecond) for { select { case <-tick: fmt.Println("tick.") case <-boom: fmt.Println("BOOM!") return default: fmt.Println(" .") time.Sleep(50 * time.Millisecond) } } }
  • 25. … iteracja po plikach fsloop.NewLoop(&fsloop.LoopData{ Filespace: fs, FileFilter: func(fs filesystem.Filespace, subPath string) bool { return strings.HasSuffix(subPath, ".json") }, OnFile: func(fs filesystem.Filespace, subPath string) error { data, err := fs.ReadFile(subPath) if err != nil { return err } tmap := map[string]string{} if err = LoadJSON("", tmap, data); err != nil { return err } i18.Set(tmap) return nil }, }, scope).Run(basePath)
  • 26. … iteracja po plikach func LoadJSON(resultKey string, result map[string]string, data []byte) error { return jsonparser.ObjectEach(data, func(key []byte, value []byte, dataType jsonparser.ValueType, offset int) error { var newResultKey string if resultKey != "" { newResultKey = resultKey + "." + string(key) } else { newResultKey = string(key) } switch dataType { case jsonparser.Object: return LoadJSON(newResultKey, result, value) case jsonparser.String: result[newResultKey] = string(value) } return nil }) }
  • 27. What makes it so fast? ● It does not rely on encoding/json, reflection or interface{}, the only real package dependency is bytes. ● Operates with JSON payload on byte level, providing you pointers to the original data structure: no memory allocation. ● No automatic type conversions, by default everything is a []byte, but it provides you value type, so you can convert by yourself (there is few helpers included). ● Does not parse full record, only keys you specified - buger/jsonparser
  • 28. Testujemy ● Testy jednostkowe ● Testy wydajnościowe > go test -v github.com/goatcms/goatcore/... > cd github.com/goatcms/goatcore/i18n/fsi18loader > go test --bench=Linear --cpu=1,2,3,4,5,6,7,8,9,10