makes it easy to build simple, reliable, and efficient software. Modern, small language Concurrency build-in Compiles to machine code Fast, super fast Staticlly typed, but feels like a dynamically typed language Designed by programmers for programmers!
p e S t r i n g e r i n t e r f a c e { S t r i n g ( ) s t r i n g } t y p e e r r o r i n t e r f a c e { E r r o r ( ) s t r i n g } t y p e S t o r e i n t e r f a c e { S e t ( u r l s t r i n g , c o u n t i n t ) e r r o r G e t ( u r l s t r i n g ) ( c o u n t i n t , e r r e r r o r ) } "No implements"
e n t s t h e j o b t o b e r u n t y p e J o b s t r u c t { U r l s t r i n g S t o r e S t o r e } / / l e t ' s c r e a t e a j o b w o r k : = J o b { U r l : u r l , S t o r e : s } Exportable: Share vs share
G r a p h s t r u c t { I d s t r i n g ` j s o n : " i d " ` S h a r e s i n t ` j s o n : " s h a r e s " ` C o m m e n t s i n t ` j s o n : " c o m m e n t s " ` } v a r g G r a p h e r r = j s o n . U n m a r s h a l ( b o d y , & g )
a i n i m p o r t ( " f m t " " m a t h / r a n d " " t i m e " ) f u n c m a i n ( ) { g o b o r i n g ( " b o r i n g ! " ) f m t . P r i n t l n ( " I ' m l i s t e n i n g . " ) t i m e . S l e e p ( 2 * t i m e . S e c o n d ) f m t . P r i n t l n ( " Y o u ' r e b o r i n g ; I ' m l e a v i n g . " ) } Run
e m a i n i m p o r t " f m t " f u n c f ( l e f t , r i g h t c h a n i n t ) { l e f t < - 1 + < - r i g h t } f u n c m a i n ( ) { c o n s t n = 1 0 0 0 0 l e f t m o s t : = m a k e ( c h a n i n t ) r i g h t : = l e f t m o s t l e f t : = l e f t m o s t f o r i : = 0 ; i < n ; i + + { r i g h t = m a k e ( c h a n i n t ) g o f ( l e f t , r i g h t ) l e f t = r i g h t } g o f u n c ( c c h a n i n t ) { c < - 1 } ( r i g h t ) f m t . P r i n t l n ( < - l e f t m o s t ) } Run
and more... c h < - v / / S e n d v t o c h a n n e l c h . v : = < - c h / / R e c e i v e f r o m c h , a n d a s s i g n t o v / / C r e a t e c h a n n e l c h : = m a k e ( c h a n i n t )
c : = m a k e ( c h a n R e s u l t ) g o f u n c ( ) { c < - F i r s t ( q u e r y , W e b 1 , W e b 2 ) } ( ) g o f u n c ( ) { c < - F i r s t ( q u e r y , I m a g e 1 , I m a g e 2 ) } ( ) g o f u n c ( ) { c < - F i r s t ( q u e r y , V i d e o 1 , V i d e o 2 ) } ( ) t i m e o u t : = t i m e . A f t e r ( 8 0 * t i m e . M i l l i s e c o n d ) f o r i : = 0 ; i < 3 ; i + + { s e l e c t { c a s e r e s u l t : = < - c : r e s u l t s = a p p e n d ( r e s u l t s , r e s u l t ) c a s e < - t i m e o u t : f m t . P r i n t l n ( " t i m e d o u t " ) r e t u r n } } r e t u r n Run
t i o n : h e l l o w o r l d v e r s i o n : 1 r u n t i m e : g o a p i _ v e r s i o n : g o 1 h a n d l e r s : - u r l : / . * s c r i p t : _ g o _ a p p
c a t i o n : h e l l o w o r l d v e r s i o n : 1 r u n t i m e : g o a p i _ v e r s i o n : g o 1 h a n d l e r s : - u r l : / . * s c r i p t : _ g o _ a p p a u t o m a t i c _ s c a l i n g : m i n _ i d l e _ i n s t a n c e s : 5 m a x _ i d l e _ i n s t a n c e s : a u t o m a t i c # d e f a u l t v a l u e m i n _ p e n d i n g _ l a t e n c y : 3 0 m s # d e f a u l t v a l u e m a x _ p e n d i n g _ l a t e n c y : a u t o m a t i c m a x _ c o n c u r r e n t _ r e q u e s t s : 5 0