├── .github └── dependabot.yml ├── .gitignore ├── LICENSE ├── README.md ├── article_01 ├── 01_hello_world.go ├── 02_better_hello_world.go ├── 03_unused_imports.go ├── 04_hello_unicode.go ├── 05_basic_type_inference.go ├── 06_variable_redeclaration.go ├── 07_variable_reassign.go ├── 08_no_true_dynamic_type.go ├── 09_simple_function.go ├── 10_function_with_params.go ├── 11_return_statement.go ├── 12_named_return_variable.go ├── 13_sum_function.go ├── 14_swap_function.go ├── 15_swap_function_B.go ├── 16_return_at_the_end_of_function.go ├── LICENSE └── README.md ├── article_02 ├── 01_integer_signed_types.go ├── 02_integer_signed_types_checks.go ├── 03_integer_unsigned_types.go ├── 04_integer_constants.go ├── 05_improper_conversion.go ├── 06_improper_conversion.go ├── 07_improper_conversion_int_uint.go ├── 08_explicit_conversions.go ├── 09_formatting_output.go ├── 10_formatting_output.go ├── 11_fp_types.go ├── 12_fp_types_checks.go ├── 13_complex_types.go ├── 14_boolean_type.go ├── 15_boolean_type_checks.go ├── 16_string_type.go ├── 17_raw_strings.go ├── 18_string_content.go ├── 19_local_variables.go ├── 20_arrays.go ├── 21_array_copy.go ├── 22_slices.go ├── 23_slice_copy.go ├── 24_slice_from_slice.go ├── LICENSE ├── README.md └── Test.java ├── article_03 ├── 01_user_types.go ├── 02_type_func_params.go ├── 03_typed_array.go ├── 04_typed_array_B.go ├── 05_user_type_checks.go ├── 06_type_check_func.go ├── 07_typed_array_check.go ├── 08_typed_array_check.go ├── 09_struct.go ├── 10_struct_init.go ├── 11_better_struct_init.go ├── 12_struct_comparison.go ├── 13_array_of_structs.go ├── 14_array_of_structs.go ├── 15_uninitialized_map.go ├── 16_initialized_map.go ├── 17_initialized_map.go ├── 18_map_and_struct.go ├── 19_map_and_struct_B.go ├── 20_reading_from_maps.go ├── 21_delete_from_map.go ├── 22_basic_pointers.go ├── 23_pointer_to_struct.go ├── 24_pointer_to_struct_item.go ├── 25_pointer_to_array_item.go ├── 26_func_type.go ├── 27_func_type_2.go ├── 28_improper_func_type.go ├── 29_func_type_3.go ├── 30_func_type_alt_block.go ├── LICENSE └── README.md ├── article_04 ├── 01_B_unique_names.go ├── 01_methods.go ├── 02_methods_with_parameters.go ├── 03_methods_ptr.go ├── 04_methods_ptr_better_solution.go ├── 05_interface.go ├── 06_interface_implementation.go ├── 07_B_wrong_return_type.go ├── 07_interface_implementation_with_method.go ├── 08_more_implementations.go ├── 09_slice_of_interfaces.go ├── 10_slice_of_interfaces_as_param.go ├── 11_multiple_interfaces.go ├── 12_embedded_interface.go ├── 13_simple_goroutine.go ├── 14_wait_for_goroutine.go ├── 15_multiple_goroutines.go ├── 16_goroutine_from_goroutine.go ├── 17_channel.go ├── 18_worker.go ├── 19_more_workers.go ├── 20_workers_deadlock.go ├── LICENSE └── README.md ├── article_05 ├── 01_main_function_only.go ├── 02_return_statement.go ├── 03_return_statement_no_value.go ├── 04_return_statement_int_value.go ├── 05_return_statement_int_value.go ├── 06_if_statement.go ├── 07_if_statement_bad_type.go ├── 08_if_statement_nil.go ├── 09_if_else_construct.go ├── 10B_statement_in_if.go ├── 10C_statement_in_if_not_visible.go ├── 10_bad_syntax.go ├── 11_switch_statement.go ├── 12_constants_in_switch.go ├── 13_variables_in_switch.go ├── 14_conditions_in_switch.go ├── 15_no_fallthrough_in_switch.go ├── 16_fallthrough_in_switch.go ├── 17_switch_combinations.go ├── 18_switch_on_string.go ├── 19_simplest_for_loop.go ├── 20_basic_for_loop.go ├── 21_for_loop_with_condition.go ├── 22_c_like_loop.go ├── 23_better_for.go ├── 24_better_for_local_variable.go ├── 25B_for_range_without_index.go ├── 25C_for_range_without_index.go ├── 25_for_range.go ├── 26_for_range_map.go ├── 27_break_statement.go ├── 28_continue_statement.go ├── 29_nested_loops.go ├── 30_break_from_inner_loop.go ├── 31_continue_from_inner_loop.go ├── LICENSE └── README.md ├── article_06 ├── 01_goto.go ├── 02_goto_from_inner_loop.go ├── 03_goto_from_switch.go ├── 04_goto_bad_usage_A.go ├── 05_goto_bad_usage_B.go ├── 06_goto_bad_usage_C.go ├── 06_goto_bad_usage_D.go ├── 06_goto_local_labels.go ├── 07_defer.go ├── 08_defer_func.go ├── 09_defer_with_parameters.go ├── 10_more_defers.go ├── 11_defer_arguments_evaluation.go ├── 12_defer_arguments_evaluation.go ├── 13_defer_on_all_returns.go ├── 14_defer_practical_usage.go ├── 15_defer_practical_usage.go ├── 16_defer_return_values.go ├── 17_panic.go ├── 18_panic_recover.go ├── 19_unary_operators.go ├── 20_relational_operators.go ├── 21_div_mod.go ├── 22_div_by_zero.go ├── 23_bit_shift_negative_shift.go ├── 24_bit_shifts.go ├── 25_bit_shift_assignment.go ├── 26_bit_operators.go ├── LICENSE └── README.md ├── article_07 ├── 01_bit_operators.go ├── 02A_boolean_operators_short_circuit.go ├── 02B_boolean_operators_improper_usage.go ├── 02C_boolean_operators_improper_usage.go ├── 02_boolean_operators.go ├── 03_inc_dec.go ├── 04_inc_dec_bad_usage.go ├── 05_inc_dec_bad_usage.go ├── 06_select_statement_receive.go ├── 07_select_statement_receive_default.go ├── 08_select_statement_send.go ├── 09B_select_statement_send.go ├── 09_select_statement_send.go ├── 10_select_statement_send_receive.go ├── 11_constants.go ├── 12_constants.go ├── 13_iota.go ├── 14_iota_better_usage.go ├── 15_iota_another_usage.go ├── 16_variadic_function.go ├── 17_variadic_function_improper_usage.go ├── 18_variadic_function_improper_usage.go ├── LICENSE ├── README.md ├── gopath_directory │ └── src │ │ ├── repository1 │ │ └── hello1 │ │ │ └── hello.go │ │ └── repository2 │ │ └── hello2 │ │ └── hello.go ├── inc1.c └── inc2.c ├── article_08 ├── 01_enum_with_iota.go ├── 02_enum_with_iota_type_check.go ├── 03_enum_with_iota.go ├── 04_enum_with_iota.go ├── 05_enum_as_type.go ├── 06_enum_as_type.go ├── 07_channel_as_fifo.go ├── 08_channel_and_range.go ├── 09_channel_and_range.go ├── 10_read_from_closed_channel.go ├── 11_sync_with_channel.go ├── 12_select_statement_receive.go ├── 13_select_statement_receive.go ├── 14_select_statement_receive.go ├── 15_alternate_import_alias.go ├── 16_alternate_import_alias.go ├── 17_alternate_import_dot.go ├── 18_alternate_import_dot.go ├── 19_use_package_hello1.go ├── 20_use_package_hello2.go ├── 21_use_package_hello3.go ├── 22_package_init.go ├── 23_package_init.go ├── LICENSE ├── README.md └── gopath_directory │ └── src │ ├── hello1 │ └── hello1.go │ ├── hello2 │ └── hello1.go │ ├── hello3 │ └── hello1.go │ ├── hello4 │ └── hello4.go │ ├── repository1 │ └── hello1 │ │ └── hello.go │ ├── repository2 │ └── hello2 │ │ └── hello.go │ ├── say_hello_1 │ └── hello.go │ └── say_hello_2 │ └── hello.go ├── article_09 ├── 01_levenshtein.go ├── 02_string_parsing_bool.go ├── 03_string_parsing_int.go ├── 04_string_parsing_uint.go ├── 05_string_parsing_atoi.go ├── 06_string_parsing_float.go ├── 07_string_format_itoa.go ├── 08_string_format_int.go ├── 09_string_format_ftoa.go ├── 10_string_format_sprintf.go ├── 11_list.go ├── 12B_print_stack_content.go ├── 12_list_as_stack.go ├── 13_gods_arraylist.go ├── 14_gods_singlylinkedlist.go ├── 15B_gods_stack_RPN.go ├── 15_gods_stack_RPN.go ├── 16_gods_set.go ├── 17_gods_rb-tree.go ├── LICENSE └── README.md ├── article_10 ├── 01_cmdline_params.go ├── 02_flags.go ├── 03_flag_shorthands.go ├── 04_bigint.go ├── 05_factorial.go ├── 06_bigfloat.go ├── 07_exec.go ├── 08_exec_stdin.go ├── 09_exec_stdin.go ├── 10_env_var.go ├── 11_process_info.go ├── 12_file_operations.go ├── LICENSE └── README.md ├── article_11 ├── 01B_simple_client_headers.go ├── 01_simple_client.go ├── 02B_simple_server_no_localhost.go ├── 02_simple_server.go ├── 03_slow_server.go ├── 04_multi_connection_server.go ├── 05_text_client.go ├── 06B_better_text_server.go ├── 06C_wrong_connection_close.go ├── 06_text_server.go ├── 07_lookup.go ├── 08_parse_ip.go ├── 09_ipv4_constructor.go ├── 10_http_get.go ├── 11_http_print_headers.go ├── 12_http_server.go ├── 13_http_server_with_state.go ├── 14_http_server_with_state_mutex.go ├── 15_file_server.go ├── 16_custom_server.go ├── LICENSE └── README.md ├── article_12 ├── 01_simple_http_server.go ├── 02_simple_http_server_write_bytes.go ├── 03_specify_content_type.go ├── 04_serve_static_html_page.go ├── 04_static_html_page.go ├── 05_serve_static_html_page.go ├── 05_static_html_page.go ├── 06_serve_static_html_page_closure.go ├── 07_html_templates.go ├── 08_factorial_prepare.go ├── 09_factorial_compute.go ├── 10_factorial_compute_const_template.go ├── 11_https_server.go ├── LICENSE ├── README.md ├── factorial.html ├── factorial_compute.html ├── index.html └── index_template.html ├── article_13 ├── 01_json_marshal_basic_signed_types.go ├── 02_json_marshal_basic_unsigned_types.go ├── 03B_json_marshal_basic_complex_types_err.go ├── 03_json_marshal_basic_complex_types.go ├── 04_json_marshal_arrays.go ├── 05_json_marshal_struct.go ├── 06B_json_mashal_array_of_struct.go ├── 06_json_mashal_array_of_struct.go ├── 07_json_marshal_map_of_structs.go ├── 08_json_marshal_map_of_structs.go ├── 09_json_marshal_complex_map.go ├── 10_json_different_keys.go ├── 11_json_marshal_special_values.go ├── 12_json_unmarshal_struct.go ├── 13_json_unmarshal_struct.go ├── 14_json_unmarshal_array.go ├── 15_json_unmarshal_array_of_struct.go ├── 16_json_unmarshal_map_of_struct.go ├── 17_json_unmarshal_map_of_struct_different_keys.go ├── 18_json_unmarshal_unknown_struct.go ├── 19_png_output.go ├── 20_jpeg_output.go ├── 21_jpeg_output_low_quality.go ├── LICENSE ├── README.md ├── numbers.json ├── user.json ├── users.json ├── users_map.json └── users_map_different_keys.json ├── article_14 ├── 01_empty_image.go ├── 02_empty_image_rectangle.go ├── 03_filled_image_setrgba.go ├── 04_filled_image_set.go ├── 05_filled_image_alpha.go ├── 06_filled_image_alpha_correct.go ├── 07_filled_image_alpha_correct.go ├── 08_image_internals.go ├── 09_raw_pixels.go ├── 10_raw_pixels2.go ├── 11_raw_pixels3.go ├── 12_point_rectangle.go ├── 13_point_rectangle_operations.go ├── 14_rgba_images.go ├── 15_cmyk_images.go ├── 16_cmyk_images.go ├── 17_chessboard.go ├── 18_bresenham_algorithm.go ├── 19_blending.go ├── LICENSE └── README.md ├── article_15 ├── 01_blending.go ├── 02_gif_export_rgba.go ├── 03_gif_1x1_rgba.go ├── 04_gif_1x1_palette.go ├── 05_gif_export_colors.go ├── 06_gif_export_palette.go ├── 07_rgba_to_palette.go ├── 08_gif_animation_blink.go ├── 09_gif_animation.go ├── 10_default_disposal_methods.go ├── 11_background_disposal_methods.go ├── 12_none_disposal_methods.go ├── 13_progress_bar.go ├── 14_gg_basic.go ├── 15_gg_context_properties.go ├── 16_gg_path_stroke.go ├── 17_gg_filled_background.go ├── 18_gg_alpha_rgba.go ├── 19_gg_line_width.go ├── 20_gg_set_dash.go ├── LICENSE └── README.md ├── article_16 ├── 01_gg_clear_screen.go ├── 02_gg_clear_screen.go ├── 03_gg_rgba_color.go ├── 04_gg_alpha_component.go ├── 05_gg_line_width.go ├── 06_gg_line_caps.go ├── 07_gg_set_dash.go ├── 08_gg_simple_path.go ├── 09_gg_open_path.go ├── 10_gg_closed_path.go ├── 11_gg_quadratic_bezier.go ├── 12_gg_quadratic_bezier_control_points.go ├── 13_gg_cubic_bezier.go ├── 14_gg_cubic_bezier_control_points.go ├── 15_gg_rotation.go ├── 16_gg_to_image.go ├── 17_gg_transformation_rotate.go ├── 18_gg_transformation_rotate_about.go ├── 19_gg_scale_about.go ├── 20_gg_translate.go ├── 21_gg_text.go ├── 22_gg_text_centered.go ├── 23_gg_text_centered.go ├── COPYING ├── LICENSE ├── README ├── README.md └── luxisr.ttf ├── article_17 ├── LICENSE ├── README.md ├── factorial │ ├── cover.out │ ├── coverage.html │ ├── factorial.go │ └── factorial_test.go ├── factorial_convey │ ├── behaviour_test.go │ └── factorial.go ├── mocking │ ├── kurzy.go │ └── kurzy.txt ├── slice_test │ └── slice_test.go ├── tests01 │ ├── add.go │ └── add_test.go ├── tests02 │ ├── add.go │ └── add_test.go ├── tests03 │ ├── add.go │ └── add_test.go ├── tests04 │ ├── add.go │ └── add_test.go ├── tests05 │ ├── add.go │ └── add_test.go ├── tests06 │ ├── add.go │ └── add_test.go ├── tests07 │ ├── add.go │ └── add_test.go └── tests08 │ ├── add.go │ ├── add_fast_test.go │ ├── add_slow_test.go │ └── add_test.go ├── article_18 ├── 01_factorial_testing │ ├── factorial.go │ └── factorial_test.go ├── 02_factorial_oglematchers │ ├── factorial.go │ └── factorial_test.go ├── 03_factorial_oglematchers2 │ ├── factorial.go │ └── factorial_test.go ├── 04_factorial_ogletest │ ├── factorial.go │ └── factorial_test.go ├── 05_factorial_ogletest2 │ ├── factorial.go │ └── factorial_test.go ├── 06_factorial_assertions │ ├── factorial.go │ └── factorial_test.go ├── 07_factorial_assertions2 │ ├── factorial.go │ └── factorial_test.go ├── 08_factorial_assertions3 │ ├── factorial.go │ └── factorial_test.go ├── 09_factorial_convey │ ├── behaviour_test.go │ ├── expected_output.txt │ └── factorial.go ├── 10_factorial_convey2 │ ├── behaviour_test.go │ └── factorial.go ├── LICENSE └── README.md ├── article_19 ├── LICENSE ├── README.md ├── build_add_element ├── build_dom_manipulation ├── build_draw_into_canvas ├── build_hello ├── build_js_interop ├── clean ├── dom_add_element.go ├── dom_add_element.html ├── dom_manipulation.go ├── dom_manipulation.html ├── draw_into_canvas.go ├── draw_into_canvas.html ├── file_server ├── file_server.go ├── hello.go ├── hello.html ├── js_interop.go ├── js_interop.html └── wasm_exec.js ├── article_20 ├── 01_scanln.go ├── 02_input_via_reader.go ├── 03_simple_input.go ├── 04_prompt.go ├── 05_basic_completer.go ├── 06_prefix_completer.go ├── 07_completion_description.go ├── 08_basic_statements.go ├── 09_fuzzy_filter.go ├── 10_two_word_commands.go ├── LICENSE └── README.md ├── article_21 ├── LICENSE ├── README.md ├── clockwerk │ ├── jobs1.go │ ├── jobs2.go │ ├── jobs3.go │ └── jobs4.go ├── clockwork │ ├── jobs1.go │ ├── jobs2.go │ ├── jobs3.go │ ├── jobs4.go │ └── jobs5.go ├── duration │ ├── duration1.go │ ├── duration2.go │ ├── duration3.go │ ├── duration4.go │ ├── duration5.go │ └── duration6.go └── go-cron │ ├── jobs1.go │ ├── jobs2.go │ ├── jobs3.go │ ├── jobs4.go │ └── jobs5.go ├── article_22 ├── 01_read_byte.go ├── 02_better_read_byte.go ├── 03_read_byte_from_unicode.go ├── 04_read_rune_from_unicode.go ├── 05_write_byte.go ├── 06_write_byte_read_rune.go ├── 07_write_rune.go ├── 08_unread_byte.go ├── 09_unread_more_bytes.go ├── 10_unread_rune.go ├── 11_io_reader_read.go ├── 12_stdin_read.go ├── 13_string_reader_read.go ├── 14_string_reader_as_str.go ├── 15_multi_reader.go ├── 16_io_writer_write.go ├── 17_input_via_reader.go ├── 18_file_block_copy.go ├── LICENSE ├── README.md ├── test_input.txt └── test_output.txt ├── article_23 ├── 01_io_reader_read.go ├── 02_io_writer_write.go ├── 03_memory_pipe.go ├── 04_memory_pipe_bytes_buffer.go ├── 05_simple_file_reader.go ├── 06_reader_seeker_absolute.go ├── 07_reader_seeker_from_end.go ├── 08_reader_seeker_relative.go ├── 09_writer_seeker.go ├── 10_writer_seeker_sparse_file.go ├── 11_multi_writer.go ├── 12_string_writer.go ├── 13_bufio_reader_read_string.go ├── 14_bufio_reader_other_file.go ├── 15_bufio_reader_read_bytes.go ├── 16_gzip_writer.go ├── 17_gzip_writer_compression_level.go ├── 18_gzip_writer_pipe.go ├── 19_gzip_multiwriter.go ├── 20_hex_dumper.go ├── 21_base_64_encoder.go ├── LICENSE ├── README.md ├── test_input.txt ├── test_input_no_eoln.txt ├── test_output.base64 ├── test_output.hex ├── test_output.txt ├── test_output_1.txt └── test_output_2.txt ├── article_24 ├── 01_server.go ├── 02_slow_server.go ├── 03_flushing_server.go ├── 04_close_detector.go ├── 05_list.go ├── 06_list_as_stack.go ├── 07_print_stack_content.go ├── 08_empty_ring.go ├── 09_filled_ring.go ├── 10_ring_empty_items.go ├── 11_ring_do_iterator.go ├── 12_ring_do_closure.go ├── 13_integer_sort.go ├── 14_float_sort.go ├── 15_string_sort.go ├── 16_reverse_sort.go ├── 17_int_slice.go ├── 18_sort_by.go ├── 19_heap.go ├── 20_heap_trace.go ├── LICENSE ├── README.md └── test_input.txt ├── article_25 ├── 01_add.go ├── 02_arrays_slices.go ├── 03_structs.go ├── 04_factorial.go ├── 05_goroutines.go ├── 06_channels.go ├── LICENSE └── README.md ├── article_26 ├── 01_boolean_type.go ├── 02_number_types.go ├── 03_string_type.go ├── 04_other_types.go ├── 05_other_types_better_solution.go ├── 06_structs.go ├── 07_nil_as_variable.go ├── 08_true_false_vars.go ├── 09_nil_value.go ├── 10B_nil_pointer.go ├── 10_nil_pointer.go ├── 11_other_pointer.go ├── 12B_nil_slice_append.go ├── 12_nil_slice.go ├── 13_nil_map.go ├── 14_nil_map_is_really_nil.go ├── 15_add_into_nil_map.go ├── 16_empty_map.go ├── 17_nil_interface.go ├── 18_two_interfaces.go ├── 19_nil_is_not_nil.go ├── 20_two_nil_pointers.go ├── 21_comparing_interface_to_pointer.go ├── 22_compare_two_different_pointer_types.go ├── 23_nil_channels.go ├── 24_nil_channel_write.go ├── 25_nil_channel_read.go ├── 26_nil_and_normal_channel.go ├── 27_three_nil_interfaces.go ├── LICENSE ├── README.md ├── nil_as_variable.clj ├── nil_as_variable.lua ├── nil_as_variable.pas ├── none_as_variable.py └── true_false_as_variables.py ├── article_27 ├── 01_do_string_1.go ├── 02B_do_string_3.go ├── 02_do_string_2.go ├── 03_do_file.go ├── 04_two_vms.go ├── 05_two_vms_in_goroutines.go ├── 06_call_lua.go ├── 07_call_lua_parameters.go ├── 08_call_lua_parameters.go ├── 09_call_lua_return_value.go ├── 10_different_data_types.go ├── 11_conversion.go ├── 12_boolean.go ├── 13_nil.go ├── 14_two_return_values.go ├── 15_go_from_lua.go ├── 16_go_from_lua_correct.go ├── 17_go_from_lua_calc.go ├── LICENSE ├── README.md ├── add.lua ├── compare.lua ├── concatenate.lua ├── function.lua ├── function_params.lua ├── go_from_lua.lua ├── go_from_lua_add.lua ├── hello.lua ├── l1.lua ├── l2.lua ├── return_nil.lua ├── swap.lua ├── v1.lua ├── v2.lua └── v3.lua ├── article_28 ├── 01_new_stream.go ├── 02_to_stream.go ├── 03_user_structs_to_stream.go ├── 04_from_array.go ├── 05_new_stream_from_array.go ├── 06_basic_attributes.go ├── 07_contains.go ├── 08_index_of.go ├── 09_contains_user_structs.go ├── 10_index_of_user_struct.go ├── 11_take.go ├── 12_add_drop.go ├── 13B_filter_anonymous.go ├── 13_filter.go ├── 14B_map_anonymous.go ├── 14_map.go ├── 15_for_each.go ├── 16B_sort_anonymous.go ├── 16_sort.go ├── 17_reverse.go ├── 18_combinations.go ├── 19_combinations_error.go ├── 20B_reduce_anonymous.go ├── 20_reduce.go ├── 21_max_value.go ├── LICENSE └── README.md ├── article_29 ├── LICENSE ├── README.md ├── clibs.go ├── file_block_copy │ ├── file_block_copy.go │ ├── output.txt │ └── test_input.txt ├── mandelbrot │ ├── mandelbrot.go │ ├── mandelbrot_test.go │ └── renderer │ │ ├── mandelbrot.go │ │ └── palettes.go ├── mandelbrot2 │ ├── mandelbrot.go │ ├── mandelbrot_test.go │ └── renderer │ │ ├── mandelbrot.go │ │ └── palettes.go ├── slices │ ├── main.go │ ├── slices │ │ └── slices.go │ └── slices_test.go └── slices2 │ ├── main.go │ ├── slices2 │ └── slices.go │ └── slices_test.go ├── article_30 ├── 01_image_server.go ├── 02_image_server_with_pprof.go ├── 03_image_server_fractal.go ├── 04_basic_tracing.go ├── 05_context.go ├── 06_context_regions.go ├── 07_region_hierarchy.go ├── LICENSE ├── README.md ├── mandelbrot3 │ ├── mandelbrot.go │ └── renderer │ │ ├── mandelbrot.go │ │ └── palettes.go ├── mandelbrot4 │ ├── mandelbrot.go │ └── renderer │ │ ├── mandelbrot.go │ │ └── palettes.go ├── mandelbrot5 │ ├── mandelbrot.go │ └── renderer │ │ ├── mandelbrot.go │ │ └── palettes.go └── slices2 │ ├── main.go │ ├── slices2 │ └── slices.go │ └── slices_test.go ├── article_31 ├── 01_image_server.go ├── 02_image_server_counter.go ├── 03_image_server_counter_mutex.go ├── 04_image_server_counter_atom.go ├── 05_image_server_expvar.go ├── 06_image_server_expvar_closure.go ├── 07_image_server_expvar_pprof.go ├── 08_image_server_fractal.go ├── 09_counter.go ├── 10_counter_lock.go ├── 11_counter_atomic.go ├── LICENSE ├── README.md ├── get_metrics_1.py ├── get_metrics_2.py └── get_metrics_3.py ├── article_32 ├── LICENSE └── README.md ├── article_33 ├── LICENSE └── README.md ├── article_34 ├── 01_empty_main.c ├── 01_empty_main.go ├── 02_hello_world.c ├── 02_hello_world.go ├── 03_data_types.c ├── 03_data_types.go ├── 04_if_then.c ├── 04_if_then.go ├── 05_if_then_else.c ├── 05_if_then_else.go ├── 06_better_approach.go ├── 06_nested_if.c ├── 06_nested_if.go ├── 07_while_loop.c ├── 07_while_loop.go ├── 08_while_loop.c ├── 09_do_while_loop.c ├── 09_do_while_loop.go ├── 10_for_loop.c ├── 10_for_loop.go ├── 11_for_loop.c ├── 11_for_loop.go ├── 12_for_loop.c ├── 12_for_loop.go ├── 13_break_in_loop.c ├── 13_break_in_loop.go ├── 13_break_in_loop_B.go ├── 14_switch.c ├── 14_switch.go ├── 15_simple_function.c ├── 15_simple_function.go ├── 16_function_with_params.c ├── 16_function_with_params.go ├── 17_return_statement.c ├── 17_return_statement.go ├── 18_variadic_function.c ├── 18_variadic_function.go ├── 19_constants.go ├── 20_constants.go ├── 21_enum.c ├── 21_iota.go ├── LICENSE ├── Makefile └── README.md ├── article_35 ├── 01_booleans.c ├── 01_booleans.go ├── 02_boolean_type_checks.go ├── 03_strings.c ├── 03_strings.go ├── 03_strings.s ├── 03_strings_B.go ├── 04_immutable_strings.c ├── 04_immutable_strings.go ├── 05_mutable_strings.c ├── 05_mutable_strings.go ├── 06_mutable_utf8_strings.c ├── 06_mutable_utf8_strings.go ├── 06_mutable_utf8_strings_B.go ├── 07_string_comparison.c ├── 07_string_comparison.go ├── 07_string_comparison_B.go ├── 07_string_comparison_C.go ├── 08_string_concatenation.c ├── 08_string_concatenation.go ├── 09_substring.c ├── 09_substring.go ├── 09_substring_B.go ├── 09_substring_C.go ├── 10_arrays.c ├── 10_arrays.go ├── 10_arrays_B.c ├── 10_arrays_C.c ├── 10_arrays_C.go ├── 11_array_copy.go ├── 12_io_reader_read_byte.go ├── 12_read_byte.c ├── 13_io_reader_read_ascii_char.go ├── 13_read_ascii_char.c ├── 14_io_reader_read_block.go ├── 14_read_block.c ├── LICENSE ├── Makefile ├── README.md └── test_input.txt ├── article_36 ├── 01_import_c.go ├── 02_import_fmt.go ├── 03_missing_include.go ├── 04_puts_go_string.go ├── 05_puts_c_string.go ├── 06_abs.go ├── 07_conversion.go ├── 08_math.go ├── 09_math_link.go ├── 10_oom.go ├── 11_no_oom.go ├── 12_free_string.go ├── 13_better_free_string.go ├── 14_free_before_use.go ├── 15_errno.go ├── 16_c_function.go ├── 17_c_strings.go ├── 18_double_free.go ├── LICENSE └── README.md ├── article_37 ├── 01_basic_metrics.go ├── 02_not_registered_counter.go ├── 03_registered_counter.go ├── 04_automatic_registration.go ├── 05_gauge.go ├── 06_summary.go ├── 07_histogram.go ├── 08_histogram_exp_buckets.go ├── 09_counter_vec.go ├── 10_histogram_vec.go ├── LICENSE └── README.md ├── article_38 ├── 01_simple_http_server.go ├── 02_http_server_with_mux.go ├── 03_method_specification.go ├── 04_method_specification.go ├── 05_resource_handling.go ├── 06_resource_handling.go ├── 07_resource_handling_id.go ├── 08_headers.go ├── 09_subroutes.go ├── 10_simple_middleware.go ├── LICENSE ├── README.md ├── ken.json └── rob.json ├── article_39 ├── 01_basic_connection.go ├── 02_connection_params.go ├── 03_customers.go ├── 04_type_checking.go ├── 05_customer_type.go ├── 06_pointer_to_struct_item.go ├── 07_query_parameter.go ├── 08_query_parameter_2.go ├── 09_query_in_raw_string.go ├── 10_insert_customer.go ├── 11_delete_customer.go ├── 12_gorm_basics.go ├── 13_column_name.go ├── 14_create_customer_improper.go ├── 15_create_customer_proper.go ├── 16_delete_customer.go ├── LICENSE ├── README.md ├── create_database.sh ├── schema.sql └── test_data.sql ├── article_40 ├── 01.log ├── 01_viper_init.go ├── 02.log ├── 02_viper_read_toml.go ├── 03.log ├── 03_viper_check.go ├── 04.log ├── 04_viper_section.go ├── 05.log ├── 05_toml_array.go ├── 06.log ├── 06_toml_int_array.go ├── 07.log ├── 07_toml_map.go ├── 08.log ├── 08_data_types.go ├── 09.log ├── 09_viper_read_json.go ├── 10.log ├── 10_viper_read_yaml.go ├── 11.log ├── 11_viper_yaml_section.go ├── 12.log ├── 12_env_variables.go ├── 13.log ├── 13_env_variables_autoname.go ├── 14.log ├── 14_env_variables_prefix.go ├── 15.log ├── 15_env_variables_autobind.go ├── LICENSE ├── README.md ├── config1.toml ├── config2.toml ├── config3.toml ├── config4.toml ├── config5.toml ├── config6.toml ├── config7.json ├── config8.yaml └── config9.yaml ├── article_41 ├── LICENSE ├── README.md ├── bdd_iteration_0 │ └── accumulator.go ├── bdd_iteration_1 │ ├── accumulator.go │ ├── accumulator_test.go │ ├── features │ │ └── accumulator.feature │ └── hint ├── bdd_iteration_2 │ ├── accumulator.go │ ├── accumulator_test.go │ └── features │ │ └── accumulator.feature ├── bdd_iteration_3 │ ├── accumulator.go │ ├── accumulator_test.go │ └── features │ │ └── accumulator.feature ├── bdd_iteration_4 │ ├── accumulator.go │ ├── accumulator_test.go │ ├── features │ │ └── accumulator.feature │ └── hint ├── bdd_iteration_5 │ ├── accumulator.go │ ├── accumulator_test.go │ ├── features │ │ └── accumulator.feature │ └── results.txt ├── bdd_iteration_5B │ ├── accumulator.go │ ├── accumulator_test.go │ ├── features │ │ └── accumulator.feature │ └── results.txt ├── bdd_iteration_6 │ ├── accumulator.go │ ├── accumulator_test.go │ └── features │ │ └── accumulator.feature └── bdd_iteration_7 │ ├── accumulator.go │ ├── accumulator_test.go │ ├── cucumber.json │ ├── events.json │ ├── features │ └── accumulator.feature │ ├── output.xml │ └── results.txt ├── article_42 ├── 01_intro_test.go ├── 02_passing_test.go ├── 03_intro_test.go ├── 04B_all_passing_test.go ├── 04_all_passing_test.go ├── 05_nested_describe_test.go ├── 06_nested_struct_test.go ├── 07_split_test.go ├── 08_nested_struct_failed_test.go ├── 09B_before_test.go ├── 09C_before_test.go ├── 09_split_failed_test.go ├── 10B_frisby_basic_usage.go ├── 10C_frisby_basic_usage.go ├── 10_frisby_basic_usage.go ├── 11_frisby_failures.go ├── 12B_frisby_check_headers.go ├── 12_frisby_check_headers.go ├── 13B_frisby_post.go ├── 13_frisby_post.go ├── 14_frisby_post_json.go ├── 15_frisby_check_content.go ├── 16_frisby_cookies.go ├── 17_frisby_threading.go ├── 18_frisby_as_test_pass_test.go ├── 19_frisby_as_test_fail_test.go ├── 20_frisby_more_test.go ├── LICENSE └── README.md ├── article_43 ├── LICENSE ├── README.md ├── gexpect │ ├── 01_check_uname_linux.go │ ├── 02_check_uname_bsd.go │ ├── 03_curl_output.go │ ├── 04_telnet_game.go │ ├── 05_telnet_game.go │ ├── 06_python.go │ ├── 07_python.go │ ├── 08_python_test.go │ └── 09_python_math_test.go └── go-expect │ ├── 01_check_uname.go │ ├── 02_check_uname_timeout.go │ ├── 03_check_curl_output.go │ ├── 04_telnet_game.go │ ├── 05_python.go │ ├── 06_python_timeout.go │ ├── 07_python_test.go │ └── 08_python_math_test.go ├── article_44 ├── 01_check_uname_linux.go ├── 02_check_uname_linux_2.go ├── 03_check_uname_bsd.go ├── 04_telnet_game_A.go ├── 05_telnet_game_B.go ├── 06_telnet_game_C.go ├── 07_python_interpreter.go ├── 08_python_version.go ├── 09_caser.go ├── 10_caser_etc.go ├── 11_error_channel.go ├── 12_error_channel.go ├── 13_python_test.go ├── 14_error_channel_test.go ├── 15_error_channel_test.go ├── LICENSE └── README.md ├── article_45 ├── LICENSE ├── README.md ├── collections │ ├── collections_test.go │ ├── go.mod │ └── go.sum ├── factorial1 │ ├── factorial.go │ ├── factorial_2_test.go │ └── factorial_test.go ├── factorial2 │ ├── factorial.go │ ├── factorial_test.go │ ├── go.mod │ └── go.sum ├── factorial2_omega │ ├── factorial.go │ ├── factorial_test.go │ ├── go.mod │ └── go.sum ├── factorial3 │ ├── factorial.go │ ├── factorial_test.go │ ├── go.mod │ └── go.sum ├── factorial4 │ ├── factorial.go │ ├── factorial_test.go │ ├── go.mod │ └── go.sum ├── factorial5 │ ├── factorial.go │ ├── factorial_test.go │ ├── go.mod │ └── go.sum ├── iteration1 │ └── factorial.go ├── iteration2 │ ├── factorial.go │ └── go.mod ├── iteration3 │ ├── factorial.go │ ├── factorial_suite_test.go │ └── go.mod ├── iteration4 │ ├── factorial.go │ ├── factorial_suite_test.go │ ├── factorial_test.go │ └── go.mod ├── iteration5 │ ├── factorial.go │ ├── factorial_suite_test.go │ ├── factorial_test.go │ └── go.mod ├── iteration6 │ ├── factorial.go │ ├── factorial_suite_test.go │ ├── factorial_test.go │ └── go.mod ├── iteration7 │ ├── factorial.go │ ├── factorial_suite_test.go │ ├── factorial_test.go │ └── go.mod └── maps │ ├── go.mod │ └── maps_test.go ├── article_46 ├── LICENSE ├── README.md ├── minio01 │ ├── go.mod │ ├── go.sum │ └── minio1.go ├── minio02 │ ├── go.mod │ ├── go.sum │ └── minio2.go ├── minio03 │ ├── go.mod │ ├── go.sum │ └── minio3.go ├── minio04 │ ├── go.mod │ ├── go.sum │ └── minio4.go ├── minio05 │ ├── go.mod │ ├── go.sum │ └── minio5.go ├── minio06 │ ├── go.mod │ ├── go.sum │ └── minio6.go ├── minio07 │ ├── go.mod │ ├── go.sum │ └── minio7.go ├── minio08 │ ├── go.mod │ ├── go.sum │ └── minio8.go ├── minio09 │ ├── go.mod │ ├── go.sum │ └── minio9.go └── minio10 │ ├── go.mod │ ├── go.sum │ └── minio10.go ├── article_47 ├── LICENSE ├── README.md ├── minio11 │ ├── go.mod │ ├── go.sum │ └── minio11.go ├── minio12 │ ├── go.mod │ ├── go.sum │ └── minio12.go ├── minio13 │ ├── go.mod │ ├── go.sum │ └── minio13.go ├── minio14 │ ├── go.mod │ ├── go.sum │ └── minio14.go ├── minio15 │ ├── go.mod │ ├── go.sum │ └── minio15.go ├── minio16 │ ├── go.mod │ ├── go.sum │ └── minio16.go ├── minio17 │ ├── go.mod │ ├── go.sum │ └── minio17.go └── python │ ├── minio1.py │ ├── minio2.py │ ├── minio3.py │ ├── minio4.py │ ├── minio6.py │ ├── minio7.py │ ├── minio8.py │ └── minio9.py ├── article_48 ├── LICENSE ├── README.md ├── mat01.go ├── mat02.go ├── mat03.go ├── mat04.go ├── mat05.go ├── mat06.go ├── mat07.go ├── mat08.go ├── mat09.go └── mat10.go ├── article_49 ├── LICENSE ├── README.md ├── floats01.go ├── floats02.go ├── floats03.go ├── floats04.go ├── floats05.go ├── floats06.go ├── floats07.go ├── floats08.go ├── floats09.go ├── floats10.go ├── mat11.go ├── mat12.go ├── mat13.go ├── mat14.go ├── mat15.go ├── mat16.go ├── mat17.go ├── mat18.go ├── mat19.go ├── mat20.go ├── mat21.go ├── mat22.go ├── mat23.go ├── mat23B.go ├── mat24.go ├── mat25.go ├── mat26.go ├── mat27.go ├── mat28.go ├── mat29.go ├── mat29B.go ├── mat30.go ├── mat31.go ├── mat32.go ├── mat32B.go ├── stat01.go ├── stat02.go ├── stat03.go ├── stat04.go ├── stat05.go ├── stat06.go ├── stat07.go ├── stat08.go └── stat09.go ├── article_50 ├── LICENSE ├── README.md ├── glot01.go ├── glot02.go ├── glot03.go ├── glot04.go ├── glot05.go ├── glot06.go ├── glot07.go ├── glot08.go ├── glot09.go ├── glot10.go ├── glot11.go ├── glot12.go ├── glot13.go ├── glot14.go ├── glot15.go ├── glot16.go ├── plot01.go ├── plot02.go ├── plot03.go └── plot04.go ├── article_51 ├── LICENSE ├── README.md ├── chart-js │ ├── plot.htm │ └── plot.js ├── chart_js.go ├── plot05.go ├── plot06.go ├── plotly01.go ├── plotly01 │ ├── plot.htm │ └── plot.js ├── plotly02.go ├── plotly02 │ ├── data.json │ ├── plot.htm │ └── plot.js ├── plotly03.go ├── plotly03 │ ├── plot.htm │ └── plot.js ├── plotly04.go ├── plotly04 │ ├── plot.htm │ └── plot.js ├── plotly05.go ├── plotly05 │ ├── plot.htm │ └── plot.js ├── plotly06.go ├── plotly06 │ ├── plot.htm │ └── plot.js ├── plotly07.go ├── plotly07 │ ├── plot.htm │ └── plot.js ├── plotly08.go ├── plotly08 │ ├── plot.htm │ └── plot.js ├── plotly09.go ├── plotly09 │ ├── plot.htm │ └── plot.js ├── plotly10.go ├── plotly10 │ ├── plot.htm │ └── plot.js └── setup.go ├── article_52 ├── LICENSE ├── README.md ├── capture01.go ├── capture02.go ├── capture03.go ├── capture04.go ├── capture05.go ├── capture06.go ├── capture07.go ├── go-capture │ ├── capture.go │ └── capture_test.go ├── httpServer1.go └── httpServer1_test.go ├── article_53 ├── LICENSE ├── README.md ├── add04 │ ├── add.go │ ├── add_amd64.s │ └── go.mod ├── add05 │ ├── add.go │ ├── add_amd64.s │ └── go.mod ├── add06 │ ├── add.go │ ├── add_amd64.s │ └── go.mod ├── add07 │ ├── add.go │ ├── add_amd64.s │ └── go.mod ├── add08 │ ├── add.go │ ├── add_amd64.s │ ├── add_arm.s │ └── go.mod ├── asm01.go ├── asm02.go └── asm03.go ├── article_54 ├── LICENSE ├── README.md ├── asm04.go ├── asm05.go ├── asm06.go ├── asm07.go └── asm08.go ├── article_55 ├── 01_no_op_filter.go ├── 02_grayscale.go ├── 03_invert.go ├── 04_grayscale_invert.go ├── 05_brightness.go ├── 06_contrast.go ├── 07_saturation.go ├── 08_gamma.go ├── 09_hue.go ├── 10_pixelate.go ├── 11_min_max_mean_median.go ├── 12_sobel.go ├── 13_emboss.go ├── 14_sharpen.go ├── 15_sharpen.go ├── LICENSE ├── README.md └── download_test_image.sh ├── article_56 ├── 01_empty_image_go │ ├── empty_image.go │ └── empty_image_test.go ├── 01_fillPixels.asm ├── 02_empty_image_asm │ ├── empty_image.go │ ├── empty_image_test.go │ ├── fill_pixels_amd64.s │ └── go.mod ├── 02_no_op_filter.asm ├── 02_no_op_filter.go ├── 03_empty_image_asm │ ├── empty_image.go │ ├── empty_image_test.go │ ├── fill_pixels_amd64.s │ └── go.mod ├── 03_no_op_filter.asm ├── 03_no_op_filter.go ├── 04_empty_image_asm │ ├── empty_image.go │ ├── empty_image_test.go │ ├── fill_pixels_amd64.s │ └── go.mod ├── 05_empty_image_asm │ ├── empty_image.go │ ├── empty_image_test.go │ ├── fill_pixels_amd64.s │ └── go.mod ├── 06_empty_image_go_memset │ ├── empty_image.go │ ├── empty_image_test.go │ ├── go.mod │ └── go.sum ├── 07_empty_image_high_level │ ├── empty_image.go │ └── empty_image_test.go ├── LICENSE ├── README.md └── slices.go ├── article_57 ├── 01_json_marshal_floats.go ├── 02_json_marshal_floats_specvalues.go ├── 02_json_marshal_floats_specvalues_err.go ├── 03_json_marshal_arrays.go ├── 04_xml_marshal_struct_1.go ├── 05_xml_marshal_struct_2.go ├── 06_xml_marshal_struct_3.go ├── 07_xml_marshal_struct_4_indent.go ├── 08_xml_marshal_struct_5_control.go ├── 08_xml_marshal_struct_5_control_B.go ├── 09_xml_marshal_arrays.go ├── 10_xml_marshal_special_types.go ├── 11_xml_marshal_array_of_struct_1.go ├── 12_xml_marshal_array_of_struct_2.go ├── 13_xml_marshal_array_of_struct_3.go ├── 14_xml_marshal_array_of_struct_4.go ├── 15_xml_and_json.go ├── 16_gob_marshal_basic_types.go ├── 17_gob_marshal_struct.go ├── 18_cbor_basic_types.go ├── 19_bson_serialize.go ├── 20_bson_deserialize.go ├── LICENSE └── README.md ├── article_58 ├── 01_gob_marshal_basic_types.go ├── 02_gob_unsigned_integers.go ├── 03_gob_signed_integers.go ├── 04_gob_slice_of_integers.go ├── 05_gob_binary_tree.go ├── 06_gob_binary_tree_2.go ├── 07_gob_binary_tree_decode.go ├── 08_json_binary_tree_decode.go ├── 09_bson_binary_tree_decode.go ├── 10_size_comparison_A.go ├── 11_size_comparison_B.go ├── 12_size_comparison_C.go ├── 13_graph.go ├── 14_graph_encode_decode.go ├── 15_cycle_in_graph.go ├── LICENSE ├── README.md ├── bson_decode_better_output.py └── bson_decode_pprint.py ├── article_59 ├── LICENSE ├── README.md ├── Test1.java ├── Test2.java ├── Test3.java ├── Test4.java ├── Test5.java ├── Test6.java ├── add1.go ├── add2.go ├── add3 │ ├── adder │ │ ├── adder.go │ │ └── adder_generic.go │ └── main.go ├── add4 │ ├── adder │ │ ├── adder.go │ │ └── adder_generic.go │ └── main.go ├── adder │ ├── adder.go │ └── adder_generic.go ├── binary_tree.go ├── binary_tree_generated.go ├── binary_tree_generic.go ├── binary_tree_generic_2.go ├── binary_tree_string.go ├── generic_function.rs ├── generic_function_type_error.rs └── generic_struct.rs ├── article_61 ├── LICENSE ├── README.md ├── c │ ├── Makefile │ ├── fractals.c │ ├── test1.bmp │ ├── test1.c │ ├── test2.c │ ├── test3.c │ └── test4.c └── go │ ├── fractals.go │ ├── test1.bmp │ ├── test1.go │ ├── test2.go │ ├── test2B.go │ ├── test3.go │ └── test4.go ├── article_62 ├── LICENSE ├── README.md ├── c │ ├── globe.png │ ├── test01.c │ ├── test02.c │ ├── test03.c │ ├── test04.c │ ├── test05.c │ ├── test06.c │ ├── test07.c │ ├── test08.c │ ├── test09.c │ ├── test1.bmp │ ├── test10.c │ ├── test11.c │ ├── test12.c │ ├── test13.c │ ├── test14.c │ └── test15.c └── go │ ├── globe.png │ ├── test01.go │ ├── test02.go │ ├── test03.go │ ├── test04.go │ ├── test05.go │ ├── test06.go │ ├── test07.go │ ├── test08.go │ ├── test09.go │ ├── test1.bmp │ ├── test10.go │ ├── test11.go │ ├── test12.go │ ├── test13.go │ ├── test14.go │ └── test15.go ├── article_63 ├── LICENSE ├── README.md ├── globe.png ├── test01.go ├── test02.go ├── test03.go ├── test04.go ├── test05.go ├── test06.go ├── test07.go ├── test08.go ├── test09.go └── test10.go ├── article_64 ├── LICENSE ├── README.md ├── game01.go ├── game02.go ├── game03.go ├── game04.go ├── game05.go ├── game06.go └── globe.png ├── article_65 ├── 01_new_client │ ├── 01_new_client.go │ ├── go.mod │ └── go.sum ├── 02_ping_pong │ ├── 02_ping_pong.go │ └── go.mod ├── 03_connection_string │ ├── 03_connection_string.go │ └── go.mod ├── 04_set_string │ ├── 04_set_string.go │ └── go.mod ├── 05_get_string │ ├── 05_get_string.go │ └── go.mod ├── 06_more_checks │ ├── 06_more_checks.go │ └── go.mod ├── 07_set_expiration │ ├── 07_set_expiration.go │ └── go.mod ├── 08_incr │ ├── 08_incr.go │ └── go.mod ├── 09_decr │ ├── 09_decr.go │ └── go.mod ├── 10_float │ ├── 10_float.go │ └── go.mod ├── 11_list │ ├── 11_list.go │ └── go.mod ├── 12_queue │ ├── 12_queue.go │ └── go.mod ├── 13_reverse_queue │ ├── 13_reverse_queue.go │ └── go.mod ├── 14_message_broker │ ├── 14_message_broker.go │ ├── 14_message_broker_B.go │ └── go.mod ├── 15_session │ ├── 15_session.go │ └── go.mod ├── LICENSE └── README.md ├── article_66 ├── 01_session │ ├── 01_session.go │ └── go.mod ├── 02_pub_sub │ ├── 02_pub_sub.go │ └── go.mod ├── 03_pub_more_sub │ ├── 03_pub_more_sub.go │ └── go.mod ├── 04_pub_sub_channel │ ├── 04_pub_sub_channel.go │ └── go.mod ├── 05_pipeline │ ├── 05_pipeline.go │ └── go.mod ├── 06_script │ ├── 06_script.go │ ├── go.mod │ └── script.lua ├── LICENSE └── README.md ├── article_67 ├── LICENSE ├── README.md ├── csv1.go ├── csv2.go ├── csv3.go ├── csv4.go ├── csv5.go ├── go.mod ├── go.sum ├── spreadsheet01.go ├── spreadsheet02.go ├── spreadsheet03.go ├── spreadsheet04.go ├── spreadsheet05.go ├── spreadsheet06.go ├── spreadsheet07.go ├── spreadsheet08.go ├── spreadsheet09.go ├── spreadsheet10.go ├── spreadsheet11.go ├── spreadsheet12.go ├── spreadsheet13.go ├── spreadsheet14.go ├── spreadsheet15.go ├── spreadsheet16.go └── spreadsheet17.go ├── article_68 ├── 01-parquet-generator │ ├── go.mod │ └── parquet-generator.go ├── 02-parquet-reader │ ├── go.mod │ └── parquet-reader.go ├── 03-bool-values │ ├── bool-values.go │ └── go.mod ├── 04-int-values │ ├── go.mod │ └── int-values.go ├── 05-int-values-packed │ ├── go.mod │ └── int-values-packed.go ├── 06-compression │ ├── compression.go │ └── go.mod ├── 07-strings │ ├── go.mod │ └── string-values.go ├── 08-dictionaries │ ├── dictionaries.go │ └── go.mod ├── 09-write-performance │ ├── go.mod │ └── write-performance.go ├── 10-read-performance │ ├── go.mod │ └── read-performance.go ├── LICENSE └── README.md ├── article_69 ├── 01-write-performance-by-records │ ├── go.mod │ └── write-performance-by-records.go ├── 02-read-performance-by-records │ ├── go.mod │ └── read-performance-by-records.go ├── 03-read-performance-by-blocks │ ├── go.mod │ └── read-performance-by-blocks.go ├── 04-write-performance-by-records-pprof │ ├── go.mod │ └── write-performance-by-records-pprof.go ├── 05-plot-read-performance-by-blocks │ ├── go.mod │ └── plot-read-performance-by-blocks.go ├── 06-plot-read-performance-by-blocks-100-readers │ ├── go.mod │ └── plot-read-performance-by-blocks-100-readers.go ├── 07-plot-read-performance-by-block-N-readers │ ├── go.mod │ └── plot-read-performance-by-blocks-N-readers.go ├── 08-read-performance-by-column-index │ ├── go.mod │ └── read-performance-by-column-index.go ├── 09-read-performance-by-column-path │ ├── go.mod │ └── read-performance-by-column-path.go ├── 10-plot-read-performance-by-column-index │ ├── go.mod │ └── plot-read-performance-by-column-index.go ├── LICENSE ├── README.md └── results │ ├── durations-1.csv │ ├── durations-100.csv │ ├── durations-N.csv │ ├── durations-column-reader-1-readers.csv │ ├── durations-column-reader-16-readers.csv │ ├── durations-column-reader-32-readers.csv │ └── durations-column-reader-8-readers.csv ├── article_70 ├── 01-tabwriter-basic-usage.go ├── 02-tabwriter-different-column-widths.go ├── 03-tabwriter-min-width.go ├── 04-tabwriter-padding.go ├── 05-tabwriter-padding-character.go ├── 06-tabwriter-align-right.go ├── 07-tabwriter-align-right-debug.go ├── 08-tabwriter-align-right-trailing-tab.go ├── 09-tabwriter-align-right-trailing-tab-debug.go ├── 10-tabwriter-factorial.go ├── 11-tabwriter-factorial-multiprint.go ├── 12-tabwriter-write-to-file.go ├── 13-tabwriter-http-server.go ├── 14-tablewriter-basic-usage.go ├── 15-tablewriter-no-border.go ├── 16-tablewriter-set-footer.go ├── 17-tablewriter-set-footer-no-border.go ├── 18-tablewriter-factorial.go ├── 19-tablewriter-write-to-file.go ├── 20-tablewriter-http-server.go ├── 21-tableprinter-basic-usage.go ├── 22-tableprinter-borders.go ├── 23-tableprinter-borders.go ├── 24-tableprinter-factorial.go ├── 25-tableprinter-write-to-file.go ├── 26-tableprinter-http-server.go ├── LICENSE ├── README.md ├── table1.txt ├── table2.txt └── table3.txt ├── article_71 ├── 01-tablewriter-basic-usage.go ├── 02-tablewriter-from-csv.go ├── 03-tablewriter-from-csv-header.go ├── 04-B-tablewriter-right-align.go ├── 04-tablewriter-left-align.go ├── 05-B-tablewriter-other-borders.go ├── 05-tablewriter-markdown-format.go ├── 06-tablewriter-set-row-line.go ├── 07-tablewriter-merge-cells.go ├── 08-tablewriter-merge-columns.go ├── 09-tablewriter-to-string.go ├── 10-tablewriter-colors.go ├── 11-tablewriter-colors.go ├── 12-go-pretty-simple-table.go ├── 13-go-pretty-footer.go ├── 14-go-pretty-style.go ├── 15-go-pretty-another-styles.go ├── 16-go-pretty-color-style.go ├── 17-go-pretty-other-color-styles.go ├── LICENSE ├── README.md ├── go-pretty-test │ ├── go.mod │ └── main.go └── tiobe.csv ├── article_72 ├── LICENSE ├── README.md ├── db_operations.go ├── db_operations_test.go ├── export_test.go ├── go.mod ├── go.sum └── pg.txt ├── article_73 ├── LICENSE ├── README.md ├── db_operations.go ├── db_operations_test.go ├── export_test.go ├── go.mod └── go.sum ├── article_74 ├── LICENSE ├── README.md ├── diagram1.dot ├── diagram1.go ├── diagram2.dot ├── diagram2.go ├── diagram3.dot ├── diagram3.go ├── diagram4.dot ├── diagram4.go ├── diagram5.dot ├── diagram5.go ├── diagram6.dot ├── diagram6.go ├── diagram7.dot └── diagram7.go ├── article_75 ├── LICENSE ├── README.md ├── confluent_kafka_consumer.go ├── confluent_kafka_producer.go ├── sarama-consumer-2 │ ├── consumer.go │ ├── go.mod │ ├── go.sum │ ├── kafka_consumer.go │ └── main.go ├── sarama-consumer │ ├── go.mod │ ├── go.sum │ └── sarama_consumer.go ├── sarama-list-topics │ ├── go.mod │ ├── go.sum │ └── sarama_list_topics.go ├── sarama-producer-2 │ ├── go.mod │ ├── go.sum │ ├── kafka_producer.go │ ├── main.go │ └── producer.go └── sarama-producer │ ├── go.mod │ ├── go.sum │ └── sarama_producer.go ├── article_76 ├── LICENSE ├── README.md ├── aurora │ ├── 01-basic-usage │ │ ├── go.mod │ │ └── main.go │ ├── 02-disable-colors │ │ ├── go.mod │ │ └── main.go │ ├── 03-colors-flag │ │ ├── go.mod │ │ └── main.go │ ├── 04-bold-attribute │ │ ├── go.mod │ │ └── main.go │ ├── 05-bold-attribute-B │ │ ├── go.mod │ │ └── main.go │ ├── 06-background-colors │ │ ├── go.mod │ │ └── main.go │ ├── 07-grayscale-foreground │ │ ├── go.mod │ │ └── main.go │ ├── 08-grayscale-background │ │ ├── go.mod │ │ └── main.go │ ├── 09-grayscale-fg-and-bg │ │ ├── go.mod │ │ └── main.go │ └── 10-8-bit-colors │ │ ├── go.mod │ │ └── main.go └── zerolog │ ├── 01-basic-usage │ ├── go.mod │ └── main.go │ ├── 02-output-to-stdout │ ├── go.mod │ └── main.go │ ├── 03-output-to-stderr │ ├── go.mod │ └── main.go │ ├── 04-chaining │ ├── go.mod │ └── main.go │ ├── 05-errors │ ├── go.mod │ └── main.go │ ├── 06-levels │ ├── go.mod │ └── main.go │ ├── 07-set-level │ ├── go.mod │ └── main.go │ ├── 08-no-level │ ├── go.mod │ └── main.go │ ├── 09-format-message │ ├── go.mod │ └── main.go │ └── 10-different-output │ ├── go.mod │ └── main.go ├── article_77 ├── LICENSE ├── README.md ├── asciigraph │ ├── 01-basic-usage.go │ ├── 02-computed-values.go │ ├── 03-to-slice.go │ ├── 04-x-range.go │ ├── 05-y-range.go │ ├── 06-slope.go │ ├── 07-negative-values.go │ ├── 08-settings.go │ ├── 09-nans.go │ └── 10-infinity.go └── cfmt-mindgrammer │ ├── 01-basic-usage.go │ ├── 02-explicit-endlines.go │ ├── 03-implicit-endlines.go │ ├── 04-mixing-with-fmt.go │ ├── 05-string-generation.go │ ├── 06-string-generation-newlines.go │ ├── 07-string-formatting.go │ ├── 08-string-content.go │ ├── 09-output-to-file.go │ └── 10-output-to-file.go ├── article_78 ├── 01_hello_world │ ├── 01_hello_world.go │ ├── go.mod │ └── go.sum ├── 02_arithmetic │ ├── 02_arithmetic.go │ ├── go.mod │ └── go.sum ├── 03_priority │ ├── 03_priority.go │ ├── go.mod │ └── go.sum ├── 04_no_constants │ ├── 04_no_constants.go │ ├── go.mod │ └── go.sum ├── 05_constants │ ├── 05_constants.go │ ├── go.mod │ └── go.sum ├── 06_more_constants │ ├── 06_more_constants.go │ ├── go.mod │ └── go.sum ├── 07_boolean_expression │ ├── 07_boolean_expression.go │ ├── go.mod │ └── go.sum ├── 08_boolean_expression │ ├── 08_boolean_expression.go │ ├── go.mod │ └── go.sum ├── 09_ternary_operator │ ├── 09_ternary_operator.go │ ├── go.mod │ └── go.sum ├── 10_ternary_operator │ ├── 10_ternary_operator.go │ ├── go.mod │ └── go.sum ├── 11_array_indexing │ ├── 11_array_indexing.go │ ├── go.mod │ └── go.sum ├── 12_struct_selector │ ├── 12_struct_selector.go │ ├── go.mod │ └── go.sum ├── 13_array_indexing_by_parameter │ ├── 13_array_indexing_by_parameter.go │ ├── go.mod │ └── go.sum ├── 14_struct_selector_by_parameter │ ├── 14_struct_selector_by_parameter.go │ ├── go.mod │ └── go.sum ├── 15_dot_selector │ ├── 15_dot_selector.go │ ├── go.mod │ └── go.sum ├── LICENSE └── README.md ├── article_79 ├── LICENSE ├── README.md ├── template01.go ├── template02.go ├── template03.go ├── template04.go ├── template05.go ├── template06.go ├── template07.go ├── template08.go ├── template09.go ├── template10.go ├── template11.go ├── template12.go ├── template13.go ├── template13.txt ├── template14.go ├── template14.txt ├── template15.go └── template15.txt ├── article_80 ├── LICENSE ├── README.md ├── template15.go ├── template15.txt ├── template16.go ├── template16.txt ├── template17.go ├── template17.txt ├── template18.go ├── template18.txt ├── template19.go ├── template19.txt ├── template20.go ├── template20.txt ├── template21.go ├── template21.txt ├── template22.go ├── template22.txt ├── template23.go ├── template23.txt ├── template24.go ├── template25.go ├── template26.go ├── template27.go ├── template28.go └── template29.go ├── article_82 ├── LICENSE ├── README.md ├── ast01.go ├── ast02.go ├── ast03.go ├── ast04.go ├── ast05.go ├── ast06.go ├── ast07.go ├── ast08.go ├── ast09.go ├── ast10.go ├── ast11.go ├── ast12.go ├── ast13.go ├── ast14.go ├── lexer1.go ├── lexer2.go ├── lexer3.go └── lexer4.go ├── article_83 ├── LICENSE ├── README.md ├── condition1.go ├── condition2.go ├── func_call_1.go ├── func_call_2.go ├── func_call_3.go ├── func_call_4.go ├── func_call_5.go ├── rpn1.go ├── rpn2.go ├── rpn3.go ├── walk1.go ├── walk2.go ├── walk3.go └── walk4.go ├── article_84 ├── LICENSE ├── README.md ├── condition1.go ├── condition2.go ├── rpn_calculator1.go ├── rpn_calculator2.go ├── rpn_calculator3.go └── rpn_from_infix.go ├── article_85 ├── LICENSE ├── README.md ├── so1.go ├── so1.h ├── so2.go ├── so2.h ├── so3.go ├── so3.h ├── so4.go ├── so4.h ├── so5.go ├── so5.h ├── so6.go ├── so6.h ├── so7.go ├── so7.h ├── use_so1.c ├── use_so1A.py ├── use_so1B.py ├── use_so2A.py ├── use_so2B.py ├── use_so3A.py ├── use_so3B.py ├── use_so3C.py ├── use_so4A.py ├── use_so4B.py ├── use_so4C.py ├── use_so5A.py ├── use_so6A.py ├── use_so6B.py ├── use_so6C.py ├── use_so7A.py ├── use_so7B.py └── use_so7C.py ├── article_86 ├── LICENSE ├── README.md ├── so10.go ├── so10.h ├── so11.go ├── so11.h ├── so8.go ├── so8.h ├── so9.go ├── so9.h ├── use_so10.py ├── use_so11.c ├── use_so11.py ├── use_so8A.py ├── use_so8B.py ├── use_so8C.py ├── use_so8D.py ├── use_so9.c ├── use_so9A.py └── use_so9B.py ├── article_87 ├── LICENSE ├── README.md ├── benchmark │ ├── bench.txt │ ├── go.mod │ ├── html_template05.htm │ ├── template_test.go │ └── templater.go ├── fsnotify │ ├── fsnotify.go │ ├── go.mod │ ├── go.sum │ └── html_template06.htm ├── html_template01.go ├── html_template01.htm ├── html_template02.go ├── html_template02.htm ├── html_template03.go ├── html_template03.htm ├── html_template04.go ├── html_template04.htm ├── html_template05.go ├── html_template05.htm ├── index.html ├── static_pages.go ├── template_pages.go ├── template_pages2.go ├── template_pages3 │ ├── go.mod │ ├── go.sum │ ├── html_template06.htm │ └── template_pages3.go ├── text_template01.go └── text_template01.txt ├── article_88 ├── 01_print.go ├── 02_print_overload.go ├── 03_print_no_conversion.go ├── 04_print_interface.go ├── 05_generic_print.go ├── 06_type_parameter.go ├── 07_type_parameter_check.go ├── 08_comparable.go ├── 09_comparable_variable_types.go ├── 10_compare_type_parameters.go ├── 11_add_int.go ├── 12_add_type_parameters.go ├── 13_add_type_parameters.go ├── 14_add_type_parameters.go ├── LICENSE └── README.md ├── article_89 ├── 16_add_type_parameters.go ├── 17_add_type_parameters.go ├── 18_add_type_parameters.go ├── 19_add_type_parameters.go ├── 20_pow.go ├── 21_pow_floats.go ├── 21_pow_floats_B.go ├── 22_pow_generic.go ├── 22_pow_generic_B.go ├── 23_pow_generic.go ├── 24_pow_generic.go ├── 25_structs.go ├── 26_structs.go ├── 27_join.go ├── 28_better_join.go ├── 29_textlike_join.go ├── 30_textlike_join.go ├── 31_slice.go ├── 32_slice_type.go ├── 33_slice_type.go ├── 34_whats_better.go ├── 35_list.go ├── LICENSE └── README.md ├── article_90 ├── LICENSE ├── README.md ├── flow1 │ ├── flow1.go │ ├── go.mod │ └── go.sum ├── flow2 │ ├── flow2.go │ ├── go.mod │ └── go.sum ├── flow3 │ ├── flow3.go │ ├── go.mod │ └── go.sum ├── flow4 │ ├── flow4.go │ ├── go.mod │ └── go.sum ├── flow5 │ ├── flow5.go │ ├── go.mod │ └── go.sum ├── flow6 │ ├── flow6.go │ ├── go.mod │ └── go.sum └── flow7 │ ├── flow7.go │ ├── go.mod │ └── go.sum ├── article_92 ├── LICENSE ├── README.md ├── arraylist01.go ├── arraylist02.go ├── arraylist03.go ├── arraylist04.go ├── arraylist05.go ├── arraylist06.go ├── arraylist07.go ├── arraylist08.go ├── arraylist09.go ├── arraylist10.go ├── arraylist11.go ├── arraystack01.go ├── arraystack02.go ├── arraystack03.go ├── arraystack04.go ├── doublylinkedlist01.go ├── doublylinkedlist02.go ├── doublylinkedlist03.go ├── doublylinkedlist04.go ├── doublylinkedlist05.go ├── doublylinkedlist06.go ├── doublylinkedlist07.go ├── doublylinkedlist08.go ├── doublylinkedlist09.go ├── doublylinkedlist10.go ├── doublylinkedlist11.go ├── erasthotenes.go ├── go.mod ├── go.sum ├── linkedliststack01.go ├── linkedliststack02.go ├── linkedliststack03.go ├── linkedliststack04.go ├── singlylinkedlist01.go ├── singlylinkedlist02.go ├── singlylinkedlist03.go ├── singlylinkedlist04.go ├── singlylinkedlist05.go ├── singlylinkedlist06.go ├── singlylinkedlist07.go ├── singlylinkedlist08.go ├── singlylinkedlist09.go ├── singlylinkedlist10.go ├── singlylinkedlist11.go ├── stack_rpn.go └── stack_rpn_B.go ├── article_93 ├── LICENSE ├── README.md ├── avl-tree01.go ├── avl-tree02.go ├── avl-tree03.go ├── avl-tree04.go ├── benchmarks │ ├── go.mod │ ├── go.sum │ ├── lists_test.go │ └── tree_test.go ├── binary_heap01.go ├── binary_heap02.go ├── binary_heap03.go ├── btree01.go ├── btree02.go ├── btree03.go ├── btree04.go ├── btree05.go ├── btree06.go ├── go.mod ├── go.sum ├── lists_test.go ├── rb-tree01.go ├── rb-tree02.go ├── rb-tree03.go ├── rb-tree04.go └── tree_test.go ├── article_94 ├── LICENSE ├── README.md ├── benchmarks │ ├── go.mod │ ├── go.sum │ └── maps_test.go ├── go.mod ├── go.sum ├── hashbidimap01.go ├── hashbidimap02.go ├── hashbidimap03.go ├── hashbidimap04.go ├── hashmap01.go ├── hashmap01error.go ├── hashmap02.go ├── hashmap02error.go ├── hashmap03.go ├── linkedhashmap01.go ├── linkedhashmap02.go ├── linkedhashmap03.go ├── linkedhashmap04.go ├── maps_test.go ├── treebidimap01.go ├── treebidimap02.go ├── treebidimap03.go ├── treebidimap04.go ├── treemap01.go ├── treemap02.go ├── treemap03.go └── treemap04.go ├── article_95 ├── 01_narray_na32.go ├── 02_narray_na64.go ├── 03_new_array.go ├── 04_reshape.go ├── 05_sum.go ├── 06_prod.go ├── 07_add.go ├── 08_add.go ├── 09_dot.go ├── 10_dot.go ├── 11_writefile.go ├── 12_readfile.go ├── 13_to_json.go ├── 14_add_constant.go ├── 15_add_scaled.go ├── 16_to_matrix.go ├── 17_matrix_column.go ├── 18_matrix_row.go ├── 19_matrix_at.go ├── 20_matrix_dims.go ├── LICENSE ├── README.md ├── cube.dat ├── go.mod ├── go.sum ├── matrix.dat └── vector.dat ├── article_96 ├── 01_empty_deque.go ├── 02_pushback.go ├── 03_length_capacity.go ├── 04_popfront_panic.go ├── 05_popfront.go ├── 06_as_queue_1.go ├── 07_as_queue_2.go ├── 08_as_stack_1.go ├── 09_as_stack_2.go ├── 10_stack_rpn.go ├── 11_rotate.go ├── 12_rotate.go ├── LICENSE ├── README.md ├── benchmarks │ ├── benchmarks.csv │ ├── deque_test.go │ ├── go.mod │ └── go.sum ├── go.mod └── go.sum ├── article_97 ├── LICENSE ├── README.md ├── fp.c ├── fp_corrected.go ├── fp_transpiled.go ├── fx.c ├── fx_corrected.go ├── fx_transpiled.go ├── go.mod ├── go.sum ├── hello.c ├── hello.go ├── strings1.c ├── strings1.go ├── strings2.c ├── strings2.go ├── tree.c ├── tree.go └── tree_corrected.go ├── article_98 ├── LICENSE ├── README.md ├── config_to_asm.go ├── map_or_slice │ ├── go.mod │ ├── go.sum │ └── map_or_slice_test.go ├── maps │ ├── go.mod │ ├── go.sum │ ├── map1_test.go │ ├── map2_test.go │ ├── map3_test.go │ └── map4_test.go ├── parameter_value_reference │ ├── conf │ │ ├── config.go │ │ ├── config.toml │ │ └── config_benchmark_test.go │ ├── config.toml │ ├── go.mod │ ├── go.sum │ └── main.go └── sets │ ├── go.mod │ └── map_or_slice_test.go ├── article_99 ├── LICENSE ├── README.md ├── mutex_channel │ ├── go.mod │ └── mutex_channel_test.go ├── parameters_benchmark_1 │ ├── go.mod │ └── parameters_test.go ├── parameters_benchmark_2 │ ├── go.mod │ └── parameters_test.go ├── pass_by_value_1.go ├── pass_by_value_2.go ├── pass_by_value_3.go ├── range-val-copy-1 │ ├── go.mod │ └── range_val_copy_test.go └── range-val-copy-2 │ ├── benchmark.txt │ ├── go.mod │ ├── out.txt │ └── parameters_test.go ├── article_A0 ├── LICENSE ├── README.md ├── glow-test-0 │ ├── go.mod │ ├── go.sum │ └── main.go ├── glow-test-1 │ ├── go.mod │ ├── go.sum │ └── main.go ├── glow-test-2 │ ├── go.mod │ ├── go.sum │ └── main.go ├── glow-test-3 │ ├── go.mod │ ├── go.sum │ └── main.go ├── glow-test-4 │ ├── go.mod │ ├── go.sum │ └── main.go ├── glow-test-5 │ ├── go.mod │ ├── go.sum │ └── main.go ├── glow-test-6 │ ├── go.mod │ ├── go.sum │ ├── m.go │ └── main.go ├── glow-test-7 │ ├── go.mod │ ├── go.sum │ └── main.go ├── glow-test-8 │ ├── data.txt │ ├── go.mod │ ├── go.sum │ └── main.go ├── glow-test-9 │ ├── data.txt │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── plot.png ├── glow-test-A │ ├── data.txt │ ├── go.mod │ ├── go.sum │ ├── main.go │ ├── main2.go │ └── plot.png └── glow-test-B │ ├── data.txt │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── plot.png ├── article_A1 ├── LICENSE ├── README.md ├── string-builders-2 │ ├── concatenation.go │ ├── go.mod │ ├── main.go │ ├── preallocated_string_buffer.go │ ├── preallocated_string_builder.go │ ├── run_benchmark.sh │ ├── string_buffer.go │ ├── string_builder.go │ └── string_builders_test.go └── string-builders │ ├── concatenation.go │ ├── go.mod │ ├── main.go │ ├── preallocated_string_buffer.go │ ├── preallocated_string_builder.go │ ├── run_benchmark.sh │ ├── run_benchmark_2.sh │ ├── string_buffer.go │ ├── string_builder.go │ └── string_builders_test.go ├── article_A2 ├── LICENSE ├── command │ ├── 20230708113941_users.sql │ ├── 20230708115539_role_column.sql │ ├── command.go │ ├── go.mod │ └── go.sum ├── migrations │ ├── 01_table_users.go │ ├── 02_role_column.go │ ├── go.mod │ ├── go.sum │ └── migrations.go ├── status │ ├── 20230708113941_users.sql │ ├── 20230708115539_role_column.sql │ ├── go.mod │ ├── go.sum │ └── status.go └── up │ ├── 20230708113941_users.sql │ ├── 20230708115539_role_column.sql │ ├── go.mod │ ├── go.sum │ ├── test.db │ └── up.go ├── article_A5 ├── LICENSE ├── app │ ├── app.go │ ├── go.mod │ └── go.sum └── httpServer │ ├── go.mod │ ├── httpServer1.go │ ├── httpServer1_cover_atomic.go │ ├── httpServer1_cover_count.go │ ├── httpServer1_cover_set.go │ └── httpServer1_test.go ├── article_A6 ├── LICENSE ├── read-npy1 │ ├── go.mod │ ├── go.sum │ ├── int8_vector.npy │ └── read-npy1.go ├── read-npy2 │ ├── go.mod │ ├── go.sum │ ├── int_vector.npy │ └── read-npy2.go ├── read-npy3 │ ├── go.mod │ ├── go.sum │ ├── int_vector.npy │ └── read-npy3.go ├── read-npy4 │ ├── float_matrix.npy │ ├── go.mod │ ├── go.sum │ └── read-npy4.go ├── read-npy5 │ ├── float_matrix.npy │ ├── go.mod │ ├── go.sum │ └── read-npy5.go ├── read-npy6 │ ├── float_matrix.npy │ ├── go.mod │ ├── go.sum │ └── read-npy6.go ├── read-npy7 │ ├── float_matrix.npy │ ├── go.mod │ ├── go.sum │ └── read-npy7.go ├── read-npy8 │ ├── go.mod │ ├── go.sum │ └── read-npy8.go ├── write-npy1 │ ├── go.mod │ ├── go.sum │ ├── int8_vector.npy │ └── write-npy1.go ├── write-npy2 │ ├── go.mod │ ├── go.sum │ ├── int_vector.npy │ └── write-npy2.go ├── write-npy3 │ ├── float_matrix.npy │ ├── go.mod │ ├── go.sum │ └── write-npy3.go └── write-npy4 │ ├── go.mod │ ├── go.sum │ ├── large_vector.txt │ └── write-npy4.go ├── article_A7 ├── LICENSE ├── haproxy_controller │ ├── go.mod │ └── haproxy_controller.go ├── multi_connection_tcp_server │ ├── go.mod │ └── multi_connection_tcp_server.go ├── multi_connection_unix_socket_server │ ├── go.mod │ └── multi_connection_unix_socket_server.go ├── simple_tcp_client │ ├── go.mod │ └── simple_tcp_client.go ├── simple_tcp_server │ ├── go.mod │ └── simple_tcp_server.go ├── simple_unix_socket_client │ ├── go.mod │ └── simple_unix_socket_client.go ├── simple_unix_socket_server │ ├── go.mod │ └── simple_tcp_server.go └── slow_tcp_server │ ├── go.mod │ └── slow_tcp_server.go ├── article_A8 ├── 01_bigint_construction.go ├── 02_bigint_add.go ├── 03_bigint_large_numbers.go ├── 04_factorial.go ├── 04_factorial_B.go ├── 04_factorial_C.go ├── 05_bigint_print_base.go ├── 06_bigint_as_bytes.go ├── 07_bigint_change_raw.go ├── 08_bigint_change_raw.go ├── 09_bigint_from_string.go ├── 10_rationals_construction.go ├── 10_rationals_construction_B.go ├── 11_rationals_add.go ├── 12_rationals_mul.go ├── 13_rational_to_int.go ├── 14_rationals_to_float.go ├── 15_pi_wallis_product.go ├── 16_pi_wallis_product_limits.go ├── 17_pi_better_wallis_product.go ├── 18_rationals_div_zero.go ├── 19_rationals_div_zero.go └── LICENSE ├── article_A9 ├── 01_bigfloat_construction.go ├── 02_bigfloat_add.go ├── 03_bigfloat_large_numbers.go ├── 04_bigfloat_small_numbers.go ├── 05_bigfloat_exp_format.go ├── 06_bigfloat_exp_format.go ├── 07_hexa_mantissa.go ├── 08_pi_wallis_product.go ├── 09_bigfloat_to_rat.go ├── 10_bigfloat_to_float64.go ├── 11_bigfloat_to_float32.go ├── 12_precision.go ├── 13_precision_B.go ├── 14_positive_infinity.go ├── 15_negative_infinity.go ├── 16_inf_operations.go ├── 17_inf_operations.go ├── 18_inf_operations.go ├── 19_catch_panic.go ├── 20_div_by_zero.go └── LICENSE ├── article_AA ├── 01_zero_value │ ├── go.mod │ ├── go.sum │ └── zero_value.go ├── 02_construct_from_int_32 │ ├── construct_from_int32.go │ ├── go.mod │ └── go.sum ├── 03_construct_from_int │ ├── construct_from_int.go │ ├── go.mod │ └── go.sum ├── 04_construct_from_float_32 │ ├── construct_from_float32.go │ ├── go.mod │ └── go.sum ├── 05_construct_from_float │ ├── construct_from_float.go │ ├── go.mod │ └── go.sum ├── 06_construct_from_float_with_exponent │ ├── construct_from_float_with_exponent.go │ ├── go.mod │ └── go.sum ├── 07_construct_from_string │ ├── construct_from_string.go │ ├── go.mod │ └── go.sum ├── 08_construct_from_formatted_string │ ├── construct_from_formatted_string.go │ ├── go.mod │ └── go.sum ├── 09_construct_from_formatted_string │ ├── construct_from_formatted_string.go │ ├── go.mod │ └── go.sum ├── 10_construct_from_formatted_string │ ├── construct_from_formatted_string.go │ ├── go.mod │ └── go.sum ├── 11_construct_from_string_err │ ├── construct_from_string_err.go │ ├── go.mod │ └── go.sum ├── 12_require_from_string │ ├── go.mod │ ├── go.sum │ └── require_from_string_err.go ├── 13_arithmetic │ ├── arithmetic.go │ ├── go.mod │ └── go.sum ├── 14_div_round │ ├── div_round.go │ ├── go.mod │ └── go.sum ├── 15_factorial │ ├── factorial.go │ ├── go.mod │ └── go.sum ├── 16_aggregation │ ├── aggregation.go │ ├── go.mod │ └── go.sum ├── 17_internals │ ├── go.mod │ ├── go.sum │ └── internals.go ├── 18_pi_wallis_product │ ├── go.mod │ ├── go.sum │ └── pi_wallis_product.go ├── 19_benchmark │ ├── go.mod │ ├── go.sum │ ├── pi_test.go │ └── run_benchmark.sh ├── LICENSE └── big_zero_values.go ├── article_AB ├── LICENSE ├── a │ ├── A1.txt │ └── A2.txt ├── access_binary.go ├── access_string.go ├── b │ ├── B1.txt │ ├── B2.txt │ └── B3.txt ├── dir.go ├── dir2.go ├── dir3.go ├── embed_binary1.go ├── embed_binary2.go ├── embed_other_data.go ├── embed_string0.go ├── embed_string1.go ├── embed_string2.go ├── embed_string3.go ├── hello.txt ├── lorem_ipsum.txt ├── more_strings1.go ├── more_strings2.go └── npe.jpg ├── article_AC ├── LICENSE ├── example_1.go ├── example_2.go ├── example_3.go ├── example_4.go ├── example_5.go ├── example_6.go ├── example_7.go ├── example_8.go ├── example_9.go ├── example_A.go ├── go.mod └── go.sum ├── article_AD ├── LICENSE ├── go.mod ├── go.sum ├── gocui01.go ├── gocui02.go ├── gocui03.go ├── gocui04.go ├── gocui05.go ├── gocui06.go ├── gocui07.go └── gocui08.go ├── article_AE ├── api_service_1.go ├── api_service_2.go ├── api_service_3.go ├── api_service_4.go └── api_service_5.go ├── articles ├── LICENSE ├── README.md ├── go_01.htm ├── go_02.htm ├── go_03.htm ├── go_04.htm ├── go_05.htm ├── go_06.htm ├── go_07.htm ├── go_08.htm ├── go_09.htm ├── go_10.htm ├── go_11.htm ├── go_12.htm ├── go_13.htm ├── go_14.htm ├── go_15.htm ├── go_16.htm ├── go_17.htm ├── go_18.htm ├── go_19.htm ├── go_20.htm ├── go_21.htm ├── go_22.htm ├── go_23.htm ├── go_24.htm ├── go_25.htm ├── go_26.htm ├── go_27.htm ├── go_28.htm ├── go_29.htm ├── go_30.htm ├── go_31.htm ├── go_32.htm ├── go_33.htm ├── go_34.htm ├── go_35.htm ├── go_36.htm ├── go_37.htm ├── go_38.htm ├── go_39.htm ├── go_40.htm ├── go_41.htm ├── go_42.htm ├── go_43.htm ├── go_44.htm ├── go_45.htm ├── go_46.htm ├── go_47.htm ├── go_48.htm ├── go_49.htm ├── go_50.htm ├── go_51.htm ├── go_52.htm ├── go_53.htm ├── go_54.htm ├── go_55.htm ├── go_56.htm ├── go_57.htm ├── go_58.htm ├── go_59.htm ├── go_60.htm ├── go_61.htm ├── go_62.htm ├── go_63.htm ├── go_64.htm ├── go_65.htm └── go_66.htm ├── benchmarks ├── LICENSE ├── byte_output │ ├── io_write_string.go │ └── write_method.go └── mandelbrot │ ├── c-buffered │ ├── Makefile │ ├── c.times │ ├── clean.sh │ ├── mandelbrot.c │ ├── palette_mandmap.h │ └── test_c.sh │ ├── c-unbuffered │ ├── Makefile │ ├── c.times │ ├── clean.sh │ ├── mandelbrot.c │ ├── palette_mandmap.h │ └── test_c.sh │ ├── c │ ├── Makefile │ ├── c.times │ ├── clean.sh │ ├── mandelbrot.c │ ├── palette_mandmap.h │ └── test_c.sh │ ├── go-buffered │ ├── build.sh │ ├── clean.sh │ ├── go.times │ ├── mandelbrot.go │ ├── palettes.go │ └── test_go.sh │ ├── go-linewise │ ├── build.sh │ ├── clean.sh │ ├── go.times │ ├── mandelbrot.go │ ├── palettes.go │ └── test_go.sh │ ├── go-parallel-complex │ ├── build.sh │ ├── clean.sh │ ├── mandelbrot.go │ ├── palettes.go │ └── test_go.sh │ ├── go-parallel │ ├── build.sh │ ├── clean.sh │ ├── go.times │ ├── mandelbrot.go │ ├── palettes.go │ └── test_go.sh │ └── go │ ├── build.sh │ ├── clean.sh │ ├── go.times │ ├── mandelbrot.go │ ├── palettes.go │ └── test_go.sh ├── consumers ├── LICENSE ├── consumers.go ├── go.mod └── go.sum ├── docs ├── article_01 │ ├── 01_hello_world.html │ ├── 02_better_hello_world.html │ ├── 03_unused_imports.html │ ├── 04_hello_unicode.html │ ├── 05_basic_type_inference.html │ ├── 06_variable_redeclaration.html │ ├── 07_variable_reassign.html │ ├── 08_no_true_dynamic_type.html │ ├── 09_simple_function.html │ ├── 10_function_with_params.html │ ├── 11_return_statement.html │ ├── 12_named_return_variable.html │ ├── 13_sum_function.html │ ├── 14_swap_function.html │ ├── 15_swap_function_B.html │ └── 16_return_at_the_end_of_function.html ├── article_02 │ ├── 01_integer_signed_types.html │ ├── 02_integer_signed_types_checks.html │ ├── 03_integer_unsigned_types.html │ ├── 04_integer_constants.html │ ├── 05_improper_conversion.html │ ├── 06_improper_conversion.html │ ├── 07_improper_conversion_int_uint.html │ ├── 08_explicit_conversions.html │ ├── 09_formatting_output.html │ ├── 10_formatting_output.html │ ├── 11_fp_types.html │ ├── 12_fp_types_checks.html │ ├── 13_complex_types.html │ ├── 14_boolean_type.html │ ├── 15_boolean_type_checks.html │ ├── 16_string_type.html │ ├── 17_raw_strings.html │ ├── 18_string_content.html │ ├── 19_local_variables.html │ ├── 20_arrays.html │ ├── 21_array_copy.html │ ├── 22_slices.html │ ├── 23_slice_copy.html │ └── 24_slice_from_slice.html ├── article_03 │ ├── 01_user_types.html │ ├── 02_type_func_params.html │ ├── 03_typed_array.html │ ├── 04_typed_array_B.html │ ├── 05_user_type_checks.html │ ├── 06_type_check_func.html │ ├── 07_typed_array_check.html │ ├── 08_typed_array_check.html │ ├── 09_struct.html │ ├── 10_struct_init.html │ ├── 11_better_struct_init.html │ ├── 12_struct_comparison.html │ ├── 13_array_of_structs.html │ ├── 14_array_of_structs.html │ ├── 15_uninitialized_map.html │ ├── 16_initialized_map.html │ ├── 17_initialized_map.html │ ├── 18_map_and_struct.html │ ├── 19_map_and_struct_B.html │ ├── 20_reading_from_maps.html │ ├── 21_delete_from_map.html │ ├── 22_basic_pointers.html │ ├── 23_pointer_to_struct.html │ ├── 24_pointer_to_struct_item.html │ ├── 25_pointer_to_array_item.html │ ├── 26_func_type.html │ ├── 27_func_type_2.html │ ├── 28_improper_func_type.html │ ├── 29_func_type_3.html │ └── 30_func_type_alt_block.html ├── article_04 │ ├── 01_B_unique_names.html │ ├── 01_methods.html │ ├── 02_methods_with_parameters.html │ ├── 03_methods_ptr.html │ ├── 04_methods_ptr_better_solution.html │ ├── 05_interface.html │ ├── 06_interface_implementation.html │ ├── 07_B_wrong_return_type.html │ ├── 07_interface_implementation_with_method.html │ ├── 08_more_implementations.html │ ├── 09_slice_of_interfaces.html │ ├── 10_slice_of_interfaces_as_param.html │ ├── 11_multiple_interfaces.html │ ├── 12_embedded_interface.html │ ├── 13_simple_goroutine.html │ ├── 14_wait_for_goroutine.html │ ├── 15_multiple_goroutines.html │ ├── 16_goroutine_from_goroutine.html │ ├── 17_channel.html │ ├── 18_worker.html │ ├── 19_more_workers.html │ └── 20_workers_deadlock.html ├── article_05 │ ├── 01_main_function_only.html │ ├── 02_return_statement.html │ ├── 03_return_statement_no_value.html │ ├── 04_return_statement_int_value.html │ ├── 05_return_statement_int_value.html │ ├── 06_if_statement.html │ ├── 07_if_statement_bad_type.html │ ├── 08_if_statement_nil.html │ ├── 09_if_else_construct.html │ ├── 10B_statement_in_if.html │ ├── 10C_statement_in_if_not_visible.html │ ├── 10_bad_syntax.html │ ├── 11_switch_statement.html │ ├── 12_constants_in_switch.html │ ├── 13_variables_in_switch.html │ ├── 14_conditions_in_switch.html │ ├── 15_no_fallthrough_in_switch.html │ ├── 16_fallthrough_in_switch.html │ ├── 17_switch_combinations.html │ ├── 18_switch_on_string.html │ ├── 19_simplest_for_loop.html │ ├── 20_basic_for_loop.html │ ├── 21_for_loop_with_condition.html │ ├── 22_c_like_loop.html │ ├── 23_better_for.html │ ├── 24_better_for_local_variable.html │ ├── 25B_for_range_without_index.html │ ├── 25C_for_range_without_index.html │ ├── 25_for_range.html │ ├── 26_for_range_map.html │ ├── 27_break_statement.html │ ├── 28_continue_statement.html │ ├── 29_nested_loops.html │ ├── 30_break_from_inner_loop.html │ └── 31_continue_from_inner_loop.html ├── article_06 │ ├── 01_goto.html │ ├── 02_goto_from_inner_loop.html │ ├── 03_goto_from_switch.html │ ├── 04_goto_bad_usage_A.html │ ├── 05_goto_bad_usage_B.html │ ├── 06_goto_bad_usage_C.html │ ├── 06_goto_bad_usage_D.html │ ├── 06_goto_local_labels.html │ ├── 07_defer.html │ ├── 08_defer_func.html │ ├── 09_defer_with_parameters.html │ ├── 10_more_defers.html │ ├── 11_defer_arguments_evaluation.html │ ├── 12_defer_arguments_evaluation.html │ ├── 13_defer_on_all_returns.html │ ├── 14_defer_practical_usage.html │ ├── 15_defer_practical_usage.html │ ├── 16_defer_return_values.html │ ├── 17_panic.html │ ├── 18_panic_recover.html │ ├── 19_unary_operators.html │ ├── 20_relational_operators.html │ ├── 21_div_mod.html │ ├── 22_div_by_zero.html │ ├── 23_bit_shift_negative_shift.html │ ├── 24_bit_shifts.html │ ├── 25_bit_shift_assignment.html │ └── 26_bit_operators.html ├── article_07 │ ├── 01_bit_operators.html │ ├── 02A_boolean_operators_short_circuit.html │ ├── 02B_boolean_operators_improper_usage.html │ ├── 02C_boolean_operators_improper_usage.html │ ├── 02_boolean_operators.html │ ├── 03_inc_dec.html │ ├── 04_inc_dec_bad_usage.html │ ├── 05_inc_dec_bad_usage.html │ ├── 06_select_statement_receive.html │ ├── 07_select_statement_receive_default.html │ ├── 08_select_statement_send.html │ ├── 09B_select_statement_send.html │ ├── 09_select_statement_send.html │ ├── 10_select_statement_send_receive.html │ ├── 11_constants.html │ ├── 12_constants.html │ ├── 13_iota.html │ ├── 14_iota_better_usage.html │ ├── 15_iota_another_usage.html │ ├── 16_variadic_function.html │ ├── 17_variadic_function_improper_usage.html │ └── 18_variadic_function_improper_usage.html ├── article_08 │ ├── 01_enum_with_iota.html │ ├── 02_enum_with_iota_type_check.html │ ├── 03_enum_with_iota.html │ ├── 04_enum_with_iota.html │ ├── 05_enum_as_type.html │ ├── 06_enum_as_type.html │ ├── 07_channel_as_fifo.html │ ├── 08_channel_and_range.html │ ├── 09_channel_and_range.html │ ├── 10_read_from_closed_channel.html │ ├── 11_sync_with_channel.html │ ├── 12_select_statement_receive.html │ ├── 13_select_statement_receive.html │ ├── 14_select_statement_receive.html │ ├── 15_alternate_import_alias.html │ ├── 16_alternate_import_alias.html │ ├── 17_alternate_import_dot.html │ ├── 18_alternate_import_dot.html │ ├── 19_use_package_hello1.html │ ├── 20_use_package_hello2.html │ ├── 21_use_package_hello3.html │ ├── 22_package_init.html │ └── 23_package_init.html ├── article_09 │ ├── 01_levenshtein.html │ ├── 02_string_parsing_bool.html │ ├── 03_string_parsing_int.html │ ├── 04_string_parsing_uint.html │ ├── 05_string_parsing_atoi.html │ ├── 06_string_parsing_float.html │ ├── 07_string_format_itoa.html │ ├── 08_string_format_int.html │ ├── 09_string_format_ftoa.html │ ├── 10_string_format_sprintf.html │ ├── 11_list.html │ ├── 12B_print_stack_content.html │ ├── 12_list_as_stack.html │ ├── 13_gods_arraylist.html │ ├── 14_gods_singlylinkedlist.html │ ├── 15B_gods_stack_RPN.html │ ├── 15_gods_stack_RPN.html │ ├── 16_gods_set.html │ └── 17_gods_rb-tree.html ├── article_10 │ ├── 01_cmdline_params.html │ ├── 02_flags.html │ ├── 03_flag_shorthands.html │ ├── 04_bigint.html │ ├── 05_factorial.html │ ├── 06_bigfloat.html │ ├── 07_exec.html │ ├── 08_exec_stdin.html │ ├── 09_exec_stdin.html │ ├── 10_env_var.html │ ├── 11_process_info.html │ └── 12_file_operations.html ├── article_11 │ ├── 01B_simple_client_headers.html │ ├── 01_simple_client.html │ ├── 02B_simple_server_no_localhost.html │ ├── 02_simple_server.html │ ├── 03_slow_server.html │ ├── 04_multi_connection_server.html │ ├── 05_text_client.html │ ├── 06B_better_text_server.html │ ├── 06C_wrong_connection_close.html │ ├── 06_text_server.html │ ├── 07_lookup.html │ ├── 08_parse_ip.html │ ├── 09_ipv4_constructor.html │ ├── 10_http_get.html │ ├── 11_http_print_headers.html │ ├── 12_http_server.html │ ├── 13_http_server_with_state.html │ ├── 14_http_server_with_state_mutex.html │ ├── 15_file_server.html │ └── 16_custom_server.html ├── article_12 │ ├── 01_simple_http_server.html │ ├── 02_simple_http_server_write_bytes.html │ ├── 03_specify_content_type.html │ ├── 04_serve_static_html_page.html │ ├── 04_static_html_page.html │ ├── 05_serve_static_html_page.html │ ├── 05_static_html_page.html │ ├── 06_serve_static_html_page_closure.html │ ├── 07_html_templates.html │ ├── 08_factorial_prepare.html │ ├── 09_factorial_compute.html │ ├── 10_factorial_compute_const_template.html │ └── 11_https_server.html ├── article_13 │ ├── 01_json_marshal_basic_signed_types.html │ ├── 02_json_marshal_basic_unsigned_types.html │ ├── 03B_json_marshal_basic_complex_types_err.html │ ├── 03_json_marshal_basic_complex_types.html │ ├── 04_json_marshal_arrays.html │ ├── 05_json_marshal_struct.html │ ├── 06B_json_mashal_array_of_struct.html │ ├── 06_json_mashal_array_of_struct.html │ ├── 07_json_marshal_map_of_structs.html │ ├── 08_json_marshal_map_of_structs.html │ ├── 09_json_marshal_complex_map.html │ ├── 10_json_different_keys.html │ ├── 11_json_marshal_special_values.html │ ├── 12_json_unmarshal_struct.html │ ├── 13_json_unmarshal_struct.html │ ├── 14_json_unmarshal_array.html │ ├── 15_json_unmarshal_array_of_struct.html │ ├── 16_json_unmarshal_map_of_struct.html │ ├── 17_json_unmarshal_map_of_struct_different_keys.html │ ├── 18_json_unmarshal_unknown_struct.html │ ├── 19_png_output.html │ ├── 20_jpeg_output.html │ └── 21_jpeg_output_low_quality.html ├── article_14 │ ├── 01_empty_image.html │ ├── 02_empty_image_rectangle.html │ ├── 03_filled_image_setrgba.html │ ├── 04_filled_image_set.html │ ├── 05_filled_image_alpha.html │ ├── 06_filled_image_alpha_correct.html │ ├── 07_filled_image_alpha_correct.html │ ├── 08_image_internals.html │ ├── 09_raw_pixels.html │ ├── 10_raw_pixels2.html │ ├── 11_raw_pixels3.html │ ├── 12_point_rectangle.html │ ├── 13_point_rectangle_operations.html │ ├── 14_rgba_images.html │ ├── 15_cmyk_images.html │ ├── 16_cmyk_images.html │ ├── 17_chessboard.html │ ├── 18_bresenham_algorithm.html │ └── 19_blending.html ├── article_15 │ ├── 01_blending.html │ ├── 02_gif_export_rgba.html │ ├── 03_gif_1x1_rgba.html │ ├── 04_gif_1x1_palette.html │ ├── 05_gif_export_colors.html │ ├── 06_gif_export_palette.html │ ├── 07_rgba_to_palette.html │ ├── 08_gif_animation_blink.html │ ├── 09_gif_animation.html │ ├── 10_default_disposal_methods.html │ ├── 11_background_disposal_methods.html │ ├── 12_none_disposal_methods.html │ ├── 13_progress_bar.html │ ├── 14_gg_basic.html │ ├── 15_gg_context_properties.html │ ├── 16_gg_path_stroke.html │ ├── 17_gg_filled_background.html │ ├── 18_gg_alpha_rgba.html │ ├── 19_gg_line_width.html │ ├── 20_gg_set_dash.html │ └── x ├── article_16 │ ├── 01_gg_clear_screen.html │ ├── 02_gg_clear_screen.html │ ├── 03_gg_rgba_color.html │ ├── 04_gg_alpha_component.html │ ├── 05_gg_line_width.html │ ├── 06_gg_line_caps.html │ ├── 07_gg_set_dash.html │ ├── 08_gg_simple_path.html │ ├── 09_gg_open_path.html │ ├── 10_gg_closed_path.html │ ├── 11_gg_quadratic_bezier.html │ ├── 12_gg_quadratic_bezier_control_points.html │ ├── 13_gg_cubic_bezier.html │ ├── 14_gg_cubic_bezier_control_points.html │ ├── 15_gg_rotation.html │ ├── 16_gg_to_image.html │ ├── 17_gg_transformation_rotate.html │ ├── 18_gg_transformation_rotate_about.html │ ├── 19_gg_scale_about.html │ ├── 20_gg_translate.html │ ├── 21_gg_text.html │ ├── 22_gg_text_centered.html │ └── 23_gg_text_centered.html ├── article_17 │ ├── factorial │ │ ├── coverage.html │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── factorial_convey │ │ ├── behaviour_test.html │ │ └── factorial.html │ ├── mocking │ │ └── kurzy.html │ ├── slice_test │ │ └── slice_test.html │ ├── tests01 │ │ ├── add.html │ │ └── add_test.html │ ├── tests02 │ │ ├── add.html │ │ └── add_test.html │ ├── tests03 │ │ ├── add.html │ │ └── add_test.html │ ├── tests04 │ │ ├── add.html │ │ └── add_test.html │ ├── tests05 │ │ ├── add.html │ │ └── add_test.html │ ├── tests06 │ │ ├── add.html │ │ └── add_test.html │ ├── tests07 │ │ ├── add.html │ │ └── add_test.html │ └── tests08 │ │ ├── add.html │ │ ├── add_fast_test.html │ │ ├── add_slow_test.html │ │ └── add_test.html ├── article_18 │ ├── 01_factorial_testing │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── 02_factorial_oglematchers │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── 03_factorial_oglematchers2 │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── 04_factorial_ogletest │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── 05_factorial_ogletest2 │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── 06_factorial_assertions │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── 07_factorial_assertions2 │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── 08_factorial_assertions3 │ │ ├── factorial.html │ │ └── factorial_test.html │ ├── 09_factorial_convey │ │ ├── behaviour_test.html │ │ └── factorial.html │ └── 10_factorial_convey2 │ │ ├── behaviour_test.html │ │ └── factorial.html ├── article_19 │ ├── dom_add_element.html │ ├── dom_manipulation.html │ ├── draw_into_canvas.html │ ├── file_server.html │ ├── hello.html │ └── js_interop.html ├── article_20 │ ├── 01_scanln.html │ ├── 02_input_via_reader.html │ ├── 03_simple_input.html │ ├── 04_prompt.html │ ├── 05_basic_completer.html │ ├── 06_prefix_completer.html │ ├── 07_completion_description.html │ ├── 08_basic_statements.html │ ├── 09_fuzzy_filter.html │ └── 10_two_word_commands.html ├── article_21 │ ├── clockwerk │ │ ├── jobs1.html │ │ ├── jobs2.html │ │ ├── jobs3.html │ │ └── jobs4.html │ ├── clockwork │ │ ├── jobs1.html │ │ ├── jobs2.html │ │ ├── jobs3.html │ │ ├── jobs4.html │ │ └── jobs5.html │ ├── duration │ │ ├── duration1.html │ │ ├── duration2.html │ │ ├── duration3.html │ │ ├── duration4.html │ │ ├── duration5.html │ │ └── duration6.html │ └── go-cron │ │ ├── jobs1.html │ │ ├── jobs2.html │ │ ├── jobs3.html │ │ ├── jobs4.html │ │ └── jobs5.html ├── article_22 │ ├── 01_read_byte.html │ ├── 02_better_read_byte.html │ ├── 03_read_byte_from_unicode.html │ ├── 04_read_rune_from_unicode.html │ ├── 05_write_byte.html │ ├── 06_write_byte_read_rune.html │ ├── 07_write_rune.html │ ├── 08_unread_byte.html │ ├── 09_unread_more_bytes.html │ ├── 10_unread_rune.html │ ├── 11_io_reader_read.html │ ├── 12_stdin_read.html │ ├── 13_string_reader_read.html │ ├── 14_string_reader_as_str.html │ ├── 15_multi_reader.html │ ├── 16_io_writer_write.html │ ├── 17_input_via_reader.html │ └── 18_file_block_copy.html ├── article_23 │ ├── 01_io_reader_read.html │ ├── 02_io_writer_write.html │ ├── 03_memory_pipe.html │ ├── 04_memory_pipe_bytes_buffer.html │ ├── 05_simple_file_reader.html │ ├── 06_reader_seeker_absolute.html │ ├── 07_reader_seeker_from_end.html │ ├── 08_reader_seeker_relative.html │ ├── 09_writer_seeker.html │ ├── 10_writer_seeker_sparse_file.html │ ├── 11_multi_writer.html │ ├── 12_string_writer.html │ ├── 13_bufio_reader_read_string.html │ ├── 14_bufio_reader_other_file.html │ ├── 15_bufio_reader_read_bytes.html │ ├── 16_gzip_writer.html │ ├── 17_gzip_writer_compression_level.html │ ├── 18_gzip_writer_pipe.html │ ├── 19_gzip_multiwriter.html │ ├── 20_hex_dumper.html │ └── 21_base_64_encoder.html ├── article_24 │ ├── 01_server.html │ ├── 02_slow_server.html │ ├── 03_flushing_server.html │ ├── 04_close_detector.html │ ├── 05_list.html │ ├── 06_list_as_stack.html │ ├── 07_print_stack_content.html │ ├── 08_empty_ring.html │ ├── 09_filled_ring.html │ ├── 10_ring_empty_items.html │ ├── 11_ring_do_iterator.html │ ├── 12_ring_do_closure.html │ ├── 13_integer_sort.html │ ├── 14_float_sort.html │ ├── 15_string_sort.html │ ├── 16_reverse_sort.html │ ├── 17_int_slice.html │ ├── 18_sort_by.html │ ├── 19_heap.html │ └── 20_heap_trace.html ├── article_25 │ ├── 01_add.html │ ├── 02_arrays_slices.html │ ├── 03_structs.html │ ├── 04_factorial.html │ ├── 05_goroutines.html │ └── 06_channels.html ├── article_26 │ ├── 01_boolean_type.html │ ├── 02_number_types.html │ ├── 03_string_type.html │ ├── 04_other_types.html │ ├── 05_other_types_better_solution.html │ ├── 06_structs.html │ ├── 07_nil_as_variable.html │ ├── 08_true_false_vars.html │ ├── 09_nil_value.html │ ├── 10B_nil_pointer.html │ ├── 10_nil_pointer.html │ ├── 11_other_pointer.html │ ├── 12B_nil_slice_append.html │ ├── 12_nil_slice.html │ ├── 13_nil_map.html │ ├── 14_nil_map_is_really_nil.html │ ├── 15_add_into_nil_map.html │ ├── 16_empty_map.html │ ├── 17_nil_interface.html │ ├── 18_two_interfaces.html │ ├── 19_nil_is_not_nil.html │ ├── 20_two_nil_pointers.html │ ├── 21_comparing_interface_to_pointer.html │ ├── 22_compare_two_different_pointer_types.html │ ├── 23_nil_channels.html │ ├── 24_nil_channel_write.html │ ├── 25_nil_channel_read.html │ ├── 26_nil_and_normal_channel.html │ └── 27_three_nil_interfaces.html ├── article_27 │ ├── 01_do_string_1.html │ ├── 02B_do_string_3.html │ ├── 02_do_string_2.html │ ├── 03_do_file.html │ ├── 04_two_vms.html │ ├── 05_two_vms_in_goroutines.html │ ├── 06_call_lua.html │ ├── 07_call_lua_parameters.html │ ├── 08_call_lua_parameters.html │ ├── 09_call_lua_return_value.html │ ├── 10_different_data_types.html │ ├── 11_conversion.html │ ├── 12_boolean.html │ ├── 13_nil.html │ ├── 14_two_return_values.html │ ├── 15_go_from_lua.html │ ├── 16_go_from_lua_correct.html │ └── 17_go_from_lua_calc.html ├── article_28 │ ├── 01_new_stream.html │ ├── 02_to_stream.html │ ├── 03_user_structs_to_stream.html │ ├── 04_from_array.html │ ├── 05_new_stream_from_array.html │ ├── 06_basic_attributes.html │ ├── 07_contains.html │ ├── 08_index_of.html │ ├── 09_contains_user_structs.html │ ├── 10_index_of_user_struct.html │ ├── 11_take.html │ ├── 12_add_drop.html │ ├── 13B_filter_anonymous.html │ ├── 13_filter.html │ ├── 14B_map_anonymous.html │ ├── 14_map.html │ ├── 15_for_each.html │ ├── 16B_sort_anonymous.html │ ├── 16_sort.html │ ├── 17_reverse.html │ ├── 18_combinations.html │ ├── 19_combinations_error.html │ ├── 20B_reduce_anonymous.html │ ├── 20_reduce.html │ └── 21_max_value.html ├── article_29 │ └── clibs.html ├── article_30 │ ├── 01_image_server.html │ ├── 02_image_server_with_pprof.html │ ├── 03_image_server_fractal.html │ ├── 04_basic_tracing.html │ ├── 05_context.html │ ├── 06_context_regions.html │ └── 07_region_hierarchy.html ├── article_31 │ ├── 01_image_server.html │ ├── 02_image_server_counter.html │ ├── 03_image_server_counter_mutex.html │ ├── 04_image_server_counter_atom.html │ ├── 05_image_server_expvar.html │ ├── 06_image_server_expvar_closure.html │ ├── 07_image_server_expvar_pprof.html │ ├── 08_image_server_fractal.html │ ├── 09_counter.html │ ├── 10_counter_lock.html │ └── 11_counter_atomic.html ├── article_34 │ ├── 01_empty_main.html │ ├── 02_hello_world.html │ ├── 03_data_types.html │ ├── 04_if_then.html │ ├── 05_if_then_else.html │ ├── 06_better_approach.html │ ├── 06_nested_if.html │ ├── 07_while_loop.html │ ├── 09_do_while_loop.html │ ├── 10_for_loop.html │ ├── 11_for_loop.html │ ├── 12_for_loop.html │ ├── 13_break_in_loop.html │ ├── 13_break_in_loop_B.html │ ├── 14_switch.html │ ├── 15_simple_function.html │ ├── 16_function_with_params.html │ ├── 17_return_statement.html │ ├── 18_variadic_function.html │ ├── 19_constants.html │ ├── 20_constants.html │ └── 21_iota.html └── index.md ├── edn ├── LICENSE ├── go-edn-1 │ ├── go.mod │ ├── go.sum │ └── main.go ├── go-edn-2 │ ├── go.mod │ ├── go.sum │ └── main.go ├── go-edn-3 │ ├── go.mod │ ├── go.sum │ └── main.go ├── go-edn-4 │ ├── go.mod │ ├── go.sum │ └── main.go ├── go-edn-5 │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── user.edn ├── go-edn-6 │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── user.edn ├── go-edn-arrays │ ├── go.mod │ ├── go.sum │ └── main.go ├── go-edn-basic-types-1 │ ├── go.mod │ ├── go.sum │ └── main.go ├── go-edn-basic-types-2 │ ├── go.mod │ ├── go.sum │ └── main.go ├── go-edn-basic-types-3 │ ├── go.mod │ ├── go.sum │ └── main.go └── go-edn-basic-types-4 │ ├── go.mod │ ├── go.sum │ └── main.go ├── lang-statistic ├── langs.py ├── langs.txt └── stats.txt ├── msgpack ├── LICENSE ├── benchmark │ ├── bench │ ├── go.mod │ ├── go.sum │ ├── serializer.go │ └── serializer_test.go ├── go.mod ├── go.sum ├── msgpack_array_16A.go ├── msgpack_array_16B.go ├── msgpack_array_16C.go ├── msgpack_array_16D.go ├── msgpack_bytes.go ├── msgpack_double.go ├── msgpack_even_longer_int.go ├── msgpack_even_longer_string.go ├── msgpack_false.go ├── msgpack_long_int.go ├── msgpack_longer_int.go ├── msgpack_longer_string.go ├── msgpack_map.go ├── msgpack_map2.go ├── msgpack_nil.go ├── msgpack_short_array1.go ├── msgpack_short_array2.go ├── msgpack_short_string.go ├── msgpack_single.go ├── msgpack_small_int.go ├── msgpack_timestamp.go ├── msgpack_true.go ├── size_comparison_A.go ├── size_comparison_B.go └── size_comparison_C.go ├── queues ├── LICENSE ├── push-pull-goroutines │ ├── publisher.go │ └── subscriber.go ├── push-pull-one-app-2 │ └── publisher_subscriber.go ├── push-pull-one-app │ └── publisher_subscriber.go └── push-pull │ ├── publisher.go │ └── subscriber.go └── tools ├── example_list.py ├── keywords_frequency.py ├── keywords_frequency.sh ├── keywords_frequency.txt ├── keywords_frequency2.txt ├── read-by-blocks-chart.py └── read-by-blocks-charts.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.obj 4 | 5 | # Executables 6 | *.exe 7 | *.out 8 | 9 | issue.py 10 | profile.out 11 | -------------------------------------------------------------------------------- /article_02/Test.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | public class Test { 4 | public static void main(String[] args) { 5 | int[] a1 = new int[10]; 6 | int[] a2 = a1; 7 | 8 | for (int i=0; i 2 | 3 | int main(void) { 4 | int x = 1; 5 | int *px = &x; 6 | *px++; 7 | printf("%d\n", x); 8 | return 0; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /article_07/inc2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | int x = 1; 5 | int *px = &x; 6 | (*px)++; 7 | printf("%d\n", x); 8 | return 0; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /article_08/gopath_directory/src/hello1/hello1.go: -------------------------------------------------------------------------------- 1 | package hello1 2 | 3 | // HelloWorld prints Hello world message on error output 4 | func HelloWorld() { 5 | println("Hello world!") 6 | } 7 | -------------------------------------------------------------------------------- /article_08/gopath_directory/src/hello2/hello1.go: -------------------------------------------------------------------------------- 1 | package hello2 2 | 3 | // HelloWorld prints Hello world message on error output 4 | func HelloWorld() { 5 | println("Hello world #2!") 6 | } 7 | -------------------------------------------------------------------------------- /article_08/gopath_directory/src/hello3/hello1.go: -------------------------------------------------------------------------------- 1 | package hello3 2 | 3 | func helloWorld() { 4 | println("Hello world #3!") 5 | } 6 | -------------------------------------------------------------------------------- /article_08/gopath_directory/src/hello4/hello4.go: -------------------------------------------------------------------------------- 1 | package hello4 2 | 3 | func init() { 4 | println("hello4.init() called") 5 | } 6 | 7 | // HelloWorld prints Hello world string on error output 8 | func HelloWorld() { 9 | println("Hello world #4!") 10 | } 11 | -------------------------------------------------------------------------------- /article_08/gopath_directory/src/repository1/hello1/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | println("repository1: Hello world!") 5 | } 6 | 7 | -------------------------------------------------------------------------------- /article_08/gopath_directory/src/repository2/hello2/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | println("repository2: Hello world!") 5 | } 6 | -------------------------------------------------------------------------------- /article_08/gopath_directory/src/say_hello_1/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | println("Hello world #1!") 5 | } 6 | 7 | -------------------------------------------------------------------------------- /article_08/gopath_directory/src/say_hello_2/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | println("Hello world #2!") 5 | } 6 | 7 | -------------------------------------------------------------------------------- /article_12/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test 4 | 5 | 6 | 7 | 8 |

Test

9 | 10 | 11 | -------------------------------------------------------------------------------- /article_12/index_template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{.Title}} 4 | 5 | 6 | 7 | 8 |

{{.Header}}

9 | 10 | 11 | -------------------------------------------------------------------------------- /article_13/numbers.json: -------------------------------------------------------------------------------- 1 | [1,10,2,9,3,8,4,7,5,6] 2 | -------------------------------------------------------------------------------- /article_13/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "Id":1, 3 | "Name":"Pepek", 4 | "Surname":"Vyskoč" 5 | } 6 | -------------------------------------------------------------------------------- /article_13/users.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Id":1, 4 | "Name":"Pepek", 5 | "Surname":"Vyskoč" 6 | }, 7 | { 8 | "Id":2, 9 | "Name":"Pepek", 10 | "Surname":"Vyskoč" 11 | }, 12 | { 13 | "Id":3, 14 | "Name":"Josef", 15 | "Surname":"Vyskočil" 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /article_13/users_map.json: -------------------------------------------------------------------------------- 1 | { 2 | "user-id-1": { 3 | "Id":1, 4 | "Name":"Pepek", 5 | "Surname":"Vyskoč" 6 | }, 7 | "user-id-2":{ 8 | "Id":2, 9 | "Name":"Josef", 10 | "Surname":"Vyskočil" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /article_13/users_map_different_keys.json: -------------------------------------------------------------------------------- 1 | { 2 | "user-id-1": { 3 | "user-id":1, 4 | "user-name":"Pepek", 5 | "surname":"Vyskoč" 6 | }, 7 | "user-id-2":{ 8 | "user-id":2, 9 | "user-name":"Josef", 10 | "surname":"Vyskočil" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /article_16/README: -------------------------------------------------------------------------------- 1 | The luxi*.ttf and COPYING files in this directory were copied from the X.org 2 | project, specifically 3 | http://xorg.freedesktop.org/releases/individual/font/font-bh-ttf-1.0.0.tar.bz2 4 | -------------------------------------------------------------------------------- /article_16/luxisr.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_16/luxisr.ttf -------------------------------------------------------------------------------- /article_17/factorial/cover.out: -------------------------------------------------------------------------------- 1 | mode: set 2 | factorial/factorial.go:3.31,4.9 1 1 3 | factorial/factorial.go:5.13,6.11 1 0 4 | factorial/factorial.go:7.14,8.11 1 1 5 | factorial/factorial.go:9.10,10.28 1 1 6 | -------------------------------------------------------------------------------- /article_19/build_add_element: -------------------------------------------------------------------------------- 1 | GOARCH=wasm GOOS=js go build -o dom_add_element.wasm dom_add_element.go 2 | -------------------------------------------------------------------------------- /article_19/build_dom_manipulation: -------------------------------------------------------------------------------- 1 | GOARCH=wasm GOOS=js go build -o dom_manipulation.wasm dom_manipulation.go 2 | -------------------------------------------------------------------------------- /article_19/build_draw_into_canvas: -------------------------------------------------------------------------------- 1 | GOARCH=wasm GOOS=js go build -o draw_into_canvas.wasm draw_into_canvas.go 2 | -------------------------------------------------------------------------------- /article_19/build_hello: -------------------------------------------------------------------------------- 1 | GOARCH=wasm GOOS=js go build -o hello.wasm hello.go 2 | -------------------------------------------------------------------------------- /article_19/build_js_interop: -------------------------------------------------------------------------------- 1 | GOARCH=wasm GOOS=js go build -o js_interop.wasm js_interop.go 2 | -------------------------------------------------------------------------------- /article_19/clean: -------------------------------------------------------------------------------- 1 | rm *.wasm 2 | -------------------------------------------------------------------------------- /article_19/file_server: -------------------------------------------------------------------------------- 1 | go run file_server.go 2 | -------------------------------------------------------------------------------- /article_22/test_input.txt: -------------------------------------------------------------------------------- 1 | line #1 2 | line #2 3 | line #3 4 | line #4 5 | line #5 6 | -------------------------------------------------------------------------------- /article_22/test_output.txt: -------------------------------------------------------------------------------- 1 | Hello world! -------------------------------------------------------------------------------- /article_23/test_input.txt: -------------------------------------------------------------------------------- 1 | line #1 2 | line #2 3 | line #3 4 | line #4 5 | line #5 6 | -------------------------------------------------------------------------------- /article_23/test_input_no_eoln.txt: -------------------------------------------------------------------------------- 1 | line #1 2 | line #2 3 | line #3 4 | line #4 5 | line #5 -------------------------------------------------------------------------------- /article_23/test_output.base64: -------------------------------------------------------------------------------- 1 | KioqIEhlbGxvIHdvcmxkISAqKio -------------------------------------------------------------------------------- /article_23/test_output.hex: -------------------------------------------------------------------------------- 1 | 00000000 2a 2a 2a 20 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 |*** Hello world!| 2 | 00000010 20 2a 2a 2a | ***| 3 | -------------------------------------------------------------------------------- /article_23/test_output.txt: -------------------------------------------------------------------------------- 1 | Hello world! -------------------------------------------------------------------------------- /article_23/test_output_1.txt: -------------------------------------------------------------------------------- 1 | Hello world! -------------------------------------------------------------------------------- /article_23/test_output_2.txt: -------------------------------------------------------------------------------- 1 | Hello world! -------------------------------------------------------------------------------- /article_25/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_25` 2 | 3 | 1. [Add method](01_add.go) 4 | 1. [Array and slice operations](02_arrays_slices.go) 5 | 1. [Struct operations](03_structs.go) 6 | 1. [Recursive factorial computation](04_factorial.go) 7 | 1. [Goroutines](05_goroutines.go) 8 | 1. [Channels](06_channels.go) 9 | -------------------------------------------------------------------------------- /article_26/nil_as_variable.clj: -------------------------------------------------------------------------------- 1 | (println nil) 2 | 3 | (def nil 42) 4 | 5 | (println nil) 6 | -------------------------------------------------------------------------------- /article_26/nil_as_variable.lua: -------------------------------------------------------------------------------- 1 | print(nil) 2 | 3 | nil = 42 4 | 5 | print(nil) 6 | -------------------------------------------------------------------------------- /article_26/nil_as_variable.pas: -------------------------------------------------------------------------------- 1 | program Riddle; 2 | 3 | var 4 | nil:integer; 5 | begin 6 | writeln('oh no...'); 7 | end. 8 | -------------------------------------------------------------------------------- /article_26/none_as_variable.py: -------------------------------------------------------------------------------- 1 | print(None) 2 | 3 | None = 42 4 | 5 | print(None) 6 | -------------------------------------------------------------------------------- /article_26/true_false_as_variables.py: -------------------------------------------------------------------------------- 1 | print(True) 2 | 3 | True = False 4 | 5 | print(True) 6 | -------------------------------------------------------------------------------- /article_27/add.lua: -------------------------------------------------------------------------------- 1 | function add(a, b) 2 | print("1st parameter", a) 3 | print("2nd parameter", b) 4 | return a+b 5 | end 6 | -------------------------------------------------------------------------------- /article_27/compare.lua: -------------------------------------------------------------------------------- 1 | function compare(a, b) 2 | print("1st parameter", a) 3 | print("2nd parameter", b) 4 | return a==b 5 | end 6 | -------------------------------------------------------------------------------- /article_27/concatenate.lua: -------------------------------------------------------------------------------- 1 | function concatenate(a, b) 2 | print("1st parameter", a) 3 | print("2nd parameter", b) 4 | return a..b 5 | end 6 | -------------------------------------------------------------------------------- /article_27/function.lua: -------------------------------------------------------------------------------- 1 | function hello() 2 | print("Hello from Lua") 3 | end 4 | -------------------------------------------------------------------------------- /article_27/function_params.lua: -------------------------------------------------------------------------------- 1 | function hello(a, b) 2 | print("Hello from Lua") 3 | print("1st parameter", a) 4 | print("2nd parameter", b) 5 | end 6 | -------------------------------------------------------------------------------- /article_27/go_from_lua.lua: -------------------------------------------------------------------------------- 1 | function call_go() 2 | print("Hello from Lua!") 3 | hello() 4 | end 5 | -------------------------------------------------------------------------------- /article_27/go_from_lua_add.lua: -------------------------------------------------------------------------------- 1 | function add(a, b) 2 | print("1st parameter", a) 3 | print("2nd parameter", b) 4 | return compute(a, b) 5 | end 6 | -------------------------------------------------------------------------------- /article_27/hello.lua: -------------------------------------------------------------------------------- 1 | for i = 1,10 do 2 | print("Hello #", i) 3 | end 4 | -------------------------------------------------------------------------------- /article_27/l1.lua: -------------------------------------------------------------------------------- 1 | for i = 1,10 do 2 | print("Hello from VM1", i) 3 | end 4 | -------------------------------------------------------------------------------- /article_27/l2.lua: -------------------------------------------------------------------------------- 1 | for i = 1,10 do 2 | print("Hello from VM2", i) 3 | end 4 | -------------------------------------------------------------------------------- /article_27/return_nil.lua: -------------------------------------------------------------------------------- 1 | function return_nil() 2 | return nil 3 | end 4 | -------------------------------------------------------------------------------- /article_27/swap.lua: -------------------------------------------------------------------------------- 1 | function swap(a, b) 2 | print("1st parameter", a) 3 | print("2nd parameter", b) 4 | return b, a 5 | end 6 | -------------------------------------------------------------------------------- /article_27/v1.lua: -------------------------------------------------------------------------------- 1 | print("v1.lua, x=", x) 2 | x = 10 3 | print("v1.lua, x=", x) 4 | -------------------------------------------------------------------------------- /article_27/v2.lua: -------------------------------------------------------------------------------- 1 | print("v2.lua, x=", x) 2 | x = 10 3 | print("v2.lua, x=", x) 4 | -------------------------------------------------------------------------------- /article_27/v3.lua: -------------------------------------------------------------------------------- 1 | print("v3.lua, x=", x) 2 | x = 10 3 | print("v3.lua, x=", x) 4 | -------------------------------------------------------------------------------- /article_29/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_29` 2 | 3 | -------------------------------------------------------------------------------- /article_29/file_block_copy/output.txt: -------------------------------------------------------------------------------- 1 | line #1 2 | line #2 3 | line #3 4 | line #4 5 | line #5 6 | -------------------------------------------------------------------------------- /article_29/file_block_copy/test_input.txt: -------------------------------------------------------------------------------- 1 | line #1 2 | line #2 3 | line #3 4 | line #4 5 | line #5 6 | -------------------------------------------------------------------------------- /article_30/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_30` 2 | 3 | -------------------------------------------------------------------------------- /article_33/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_33` 2 | 3 | * Examples used in the following article 4 | [Systém modulů v programovacím jazyce Go](https://www.root.cz/clanky/system-modulu-v-programovacim-jazyce-go/) 5 | 6 | * This article is part of the serie about Go programming language 7 | [Programovací jazyk Go](https://www.root.cz/serialy/programovaci-jazyk-go/) 8 | 9 | -------------------------------------------------------------------------------- /article_34/01_empty_main.c: -------------------------------------------------------------------------------- 1 | /* 2 | Seriál "Programovací jazyk Go" 3 | 4 | Třicátá čtvrtá část 5 | Programovací jazyk Go pro skalní céčkaře 6 | https://www.root.cz/clanky/programovaci-jazyk-go-pro-skalni-ceckare/ 7 | */ 8 | 9 | int main(void) 10 | { 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /article_34/02_hello_world.c: -------------------------------------------------------------------------------- 1 | /* 2 | Seriál "Programovací jazyk Go" 3 | 4 | Třicátá čtvrtá část 5 | Programovací jazyk Go pro skalní céčkaře 6 | https://www.root.cz/clanky/programovaci-jazyk-go-pro-skalni-ceckare/ 7 | */ 8 | 9 | #include 10 | 11 | int main(void) 12 | { 13 | puts("Hello world!"); 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /article_34/04_if_then.c: -------------------------------------------------------------------------------- 1 | /* 2 | Seriál "Programovací jazyk Go" 3 | 4 | Třicátá čtvrtá část 5 | Programovací jazyk Go pro skalní céčkaře 6 | https://www.root.cz/clanky/programovaci-jazyk-go-pro-skalni-ceckare/ 7 | */ 8 | 9 | #include 10 | 11 | int main(void) 12 | { 13 | int x = 10; 14 | 15 | if (x > 0) { 16 | puts("x is positive number"); 17 | } 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /article_34/08_while_loop.c: -------------------------------------------------------------------------------- 1 | /* 2 | Seriál "Programovací jazyk Go" 3 | 4 | Třicátá čtvrtá část 5 | Programovací jazyk Go pro skalní céčkaře 6 | https://www.root.cz/clanky/programovaci-jazyk-go-pro-skalni-ceckare/ 7 | */ 8 | 9 | #include 10 | 11 | int main(void) 12 | { 13 | int x = 0; 14 | 15 | while (x++ < 10) { 16 | printf("%d\n", x); 17 | } 18 | 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /article_34/15_simple_function.c: -------------------------------------------------------------------------------- 1 | /* 2 | Seriál "Programovací jazyk Go" 3 | 4 | Třicátá čtvrtá část 5 | Programovací jazyk Go pro skalní céčkaře 6 | https://www.root.cz/clanky/programovaci-jazyk-go-pro-skalni-ceckare/ 7 | */ 8 | 9 | #include 10 | 11 | void printHello(void) { 12 | puts("Hello world!"); 13 | } 14 | 15 | int main(void) { 16 | printHello(); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /article_34/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_34` 2 | 3 | -------------------------------------------------------------------------------- /article_35/Makefile: -------------------------------------------------------------------------------- 1 | # Parametry prekladace. 2 | CFLAGS=-Wall -ansi 3 | 4 | all: 01_booleans 03_strings 04_immutable_strings 05_mutable_strings 06_mutable_utf8_strings \ 5 | 07_string_comparison 08_string_concatenation 6 | 7 | 8 | # potentially dangerous thing!!! 9 | clean: 10 | find . -type f -executable -delete 11 | 12 | 13 | %: %.c 14 | $(CC) $(CFLAGS) $< -o $@ 15 | -------------------------------------------------------------------------------- /article_35/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_35` 2 | 3 | -------------------------------------------------------------------------------- /article_35/test_input.txt: -------------------------------------------------------------------------------- 1 | line #1 2 | line #2 3 | line #3 4 | line #4 5 | line #5 6 | -------------------------------------------------------------------------------- /article_36/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_36` 2 | 3 | -------------------------------------------------------------------------------- /article_37/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_37` 2 | 3 | -------------------------------------------------------------------------------- /article_38/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_38` 2 | 3 | -------------------------------------------------------------------------------- /article_38/ken.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstname": "Ken", 3 | "lastname": "Thompson" 4 | } 5 | -------------------------------------------------------------------------------- /article_38/rob.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstname": "Robert", 3 | "lastname": "Pike" 4 | } 5 | -------------------------------------------------------------------------------- /article_39/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_39` 2 | 3 | -------------------------------------------------------------------------------- /article_39/create_database.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DATABASE=test.db 4 | 5 | SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" 6 | 7 | cat "${SCRIPT_DIR}/schema.sql" | sqlite3 "${SCRIPT_DIR}/${DATABASE}" 8 | cat "${SCRIPT_DIR}/test_data.sql" | sqlite3 "${SCRIPT_DIR}/${DATABASE}" 9 | -------------------------------------------------------------------------------- /article_40/01.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:04 Reading configuration 2 | 2019/10/30 13:26:04 Done 3 | -------------------------------------------------------------------------------- /article_40/02.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:04 Reading configuration 2 | 2019/10/30 13:26:04 Done 3 | 2019/10/30 13:26:04 Starting the service at address http://1.2.3.4:8888 4 | -------------------------------------------------------------------------------- /article_40/03.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:05 Reading configuration 2 | 2019/10/30 13:26:05 Done 3 | 2019/10/30 13:26:05 Starting the service at address http://1.2.3.4:8888 4 | -------------------------------------------------------------------------------- /article_40/04.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:05 Reading configuration 2 | 2019/10/30 13:26:05 Done 3 | 2019/10/30 13:26:05 Starting the service at address http://1.2.3.4:8888 4 | -------------------------------------------------------------------------------- /article_40/05.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:06 Reading configuration 2 | 2019/10/30 13:26:06 Done 3 | 2019/10/30 13:26:06 Starting the service at address http://1.2.3.4:8888 4 | 2019/10/30 13:26:06 Accepted users: [qa devel manager] 5 | 2019/10/30 13:26:06 Blacklisted users: [cracker] 6 | -------------------------------------------------------------------------------- /article_40/06.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:06 Reading configuration 2 | 2019/10/30 13:26:06 Done 3 | 2019/10/30 13:26:06 Starting the service at address http://1.2.3.4:8888 4 | 2019/10/30 13:26:06 Accepted users: [qa devel manager] 5 | 2019/10/30 13:26:06 Blacklisted users: [cracker] 6 | 2019/10/30 13:26:06 UIDs: [0 42 1000 1001] 7 | -------------------------------------------------------------------------------- /article_40/07.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:07 Reading configuration 2 | 2019/10/30 13:26:07 Done 3 | 2019/10/30 13:26:07 Starting the service at address http://1.2.3.4:8888 4 | 2019/10/30 13:26:07 Accepted users: [qa devel manager] 5 | 2019/10/30 13:26:07 Blacklisted users: [cracker] 6 | 2019/10/30 13:26:07 UIDs: [0 42 1000 1001] 7 | -------------------------------------------------------------------------------- /article_40/08.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:07 Reading configuration 2 | 2019/10/30 13:26:07 Done 3 | integer1: 1 4 | integer2: 42 5 | float1: 3.140000 6 | float2: -0.000020 7 | float3: -Inf 8 | float4: NaN 9 | bool1: true 10 | bool2: false 11 | date1: Sat Jan 1 01:10:00 UTC 2000 12 | date2: Sat Jan 1 01:10:00 -0200 2000 13 | date3: Sat Jan 1 01:10:00 UTC 2000 14 | date4: Sat Jan 1 01:10:00 +0630 2000 15 | -------------------------------------------------------------------------------- /article_40/09.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:08 Reading configuration 2 | 2019/10/30 13:26:08 Done 3 | 2019/10/30 13:26:08 Starting the service at address http://1.2.3.4:8888 4 | -------------------------------------------------------------------------------- /article_40/10.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:08 Reading configuration 2 | 2019/10/30 13:26:08 Done 3 | 2019/10/30 13:26:08 Starting the service at address http://1.2.3.4:8888 4 | -------------------------------------------------------------------------------- /article_40/11.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:09 Reading configuration 2 | 2019/10/30 13:26:09 Done 3 | 2019/10/30 13:26:09 Starting the service at address http://1.2.3.4:8888 4 | -------------------------------------------------------------------------------- /article_40/12.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:09 Reading configuration 2 | 2019/10/30 13:26:09 Done 3 | 2019/10/30 13:26:09 Selected editor: vim 4 | -------------------------------------------------------------------------------- /article_40/13.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:10 Reading configuration 2 | 2019/10/30 13:26:10 Done 3 | 2019/10/30 13:26:10 Selected editor: vim 4 | -------------------------------------------------------------------------------- /article_40/14.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:10 Reading configuration 2 | 2019/10/30 13:26:10 Done 3 | 2019/10/30 13:26:10 Xterm locale: en_US.UTF-8 4 | 2019/10/30 13:26:10 Xterm shell: /bin/bash 5 | -------------------------------------------------------------------------------- /article_40/15.log: -------------------------------------------------------------------------------- 1 | 2019/10/30 13:26:11 Reading configuration 2 | 2019/10/30 13:26:11 Done 3 | 2019/10/30 13:26:11 Xterm locale: en_US.UTF-8 4 | 2019/10/30 13:26:11 Xterm shell: /bin/bash 5 | -------------------------------------------------------------------------------- /article_40/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_40` 2 | 3 | -------------------------------------------------------------------------------- /article_40/config1.toml: -------------------------------------------------------------------------------- 1 | url="http://1.2.3.4" 2 | port=8888 3 | -------------------------------------------------------------------------------- /article_40/config2.toml: -------------------------------------------------------------------------------- 1 | [service] 2 | url="http://1.2.3.4" 3 | port=8888 4 | -------------------------------------------------------------------------------- /article_40/config3.toml: -------------------------------------------------------------------------------- 1 | [service] 2 | url="http://1.2.3.4" 3 | port=8888 4 | 5 | [users] 6 | accepted=["qa", "devel", "manager"] 7 | blacklisted=["cracker"] 8 | -------------------------------------------------------------------------------- /article_40/config4.toml: -------------------------------------------------------------------------------- 1 | [service] 2 | url="http://1.2.3.4" 3 | port=8888 4 | 5 | [users] 6 | accepted=["qa", "devel", "manager"] 7 | blacklisted=["cracker"] 8 | ids=[0,42,1000,1001] 9 | -------------------------------------------------------------------------------- /article_40/config5.toml: -------------------------------------------------------------------------------- 1 | [service] 2 | service.url="http://1.2.3.4" 3 | service.port=8888 4 | 5 | [users] 6 | accepted=["qa", "devel", "manager"] 7 | blacklisted=["cracker"] 8 | ids=[0,42,1000,1001] 9 | -------------------------------------------------------------------------------- /article_40/config6.toml: -------------------------------------------------------------------------------- 1 | integer1 = 1 2 | integer2 = 0x2a 3 | 4 | float1 = 3.14 5 | float2 = -2e-5 6 | float3 = -inf 7 | float4 = nan 8 | 9 | bool1 = true 10 | bool2 = false 11 | 12 | date1 = 2000-01-01 01:10:00Z 13 | date2 = 2000-01-01 01:10:00-02:00 14 | date3 = 2000-01-01T01:10:00Z 15 | date4 = 2000-01-01T01:10:00+06:30 16 | -------------------------------------------------------------------------------- /article_40/config7.json: -------------------------------------------------------------------------------- 1 | { 2 | "url" : "http://1.2.3.4", 3 | "port" : 8888 4 | } 5 | -------------------------------------------------------------------------------- /article_40/config8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | url: http://1.2.3.4 3 | port: 8888 4 | -------------------------------------------------------------------------------- /article_40/config9.yaml: -------------------------------------------------------------------------------- 1 | service: 2 | url: 'http://1.2.3.4' 3 | port: 8888 4 | -------------------------------------------------------------------------------- /article_41/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_41` 2 | 3 | -------------------------------------------------------------------------------- /article_41/bdd_iteration_1/features/accumulator.feature: -------------------------------------------------------------------------------- 1 | Feature: simple accumulator checks 2 | An accumulator must be able to add a number to its content 3 | 4 | Scenario: Accumulate positive integer 5 | Given I have an accumulator with 0 6 | When I add 2 to accumulator 7 | Then the accumulated result should be 2 8 | -------------------------------------------------------------------------------- /article_41/bdd_iteration_2/features/accumulator.feature: -------------------------------------------------------------------------------- 1 | Feature: simple accumulator checks 2 | An accumulator must be able to add a number to its content 3 | 4 | Scenario: Accumulate positive integer 5 | Given I have an accumulator with 0 6 | When I add 2 to accumulator 7 | Then the accumulated result should be 2 8 | -------------------------------------------------------------------------------- /article_41/bdd_iteration_3/features/accumulator.feature: -------------------------------------------------------------------------------- 1 | Feature: simple accumulator checks 2 | An accumulator must be able to add a number to its content 3 | 4 | Scenario: Accumulate positive integer 5 | Given I have an accumulator with 0 6 | When I add 2 to accumulator 7 | Then the accumulated result should be 2 8 | -------------------------------------------------------------------------------- /article_42/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_42` 2 | 3 | -------------------------------------------------------------------------------- /article_43/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_43` 2 | 3 | -------------------------------------------------------------------------------- /article_44/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_44` 2 | 3 | -------------------------------------------------------------------------------- /article_45/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_45` 2 | 3 | -------------------------------------------------------------------------------- /article_45/collections/go.mod: -------------------------------------------------------------------------------- 1 | module factorial.go 2 | 3 | require github.com/onsi/gomega v1.7.1 4 | 5 | require ( 6 | golang.org/x/text v0.7.0 // indirect 7 | gopkg.in/yaml.v2 v2.2.8 // indirect 8 | ) 9 | 10 | go 1.14 11 | -------------------------------------------------------------------------------- /article_45/factorial2/go.mod: -------------------------------------------------------------------------------- 1 | module factorial.go 2 | 3 | require github.com/onsi/gomega v1.7.1 4 | 5 | require ( 6 | golang.org/x/text v0.7.0 // indirect 7 | gopkg.in/yaml.v2 v2.2.8 // indirect 8 | ) 9 | 10 | go 1.14 11 | -------------------------------------------------------------------------------- /article_45/factorial2_omega/go.mod: -------------------------------------------------------------------------------- 1 | module factorial.go 2 | 3 | require github.com/onsi/gomega v1.7.1 4 | 5 | require ( 6 | golang.org/x/text v0.7.0 // indirect 7 | gopkg.in/yaml.v2 v2.2.8 // indirect 8 | ) 9 | 10 | go 1.14 11 | -------------------------------------------------------------------------------- /article_45/factorial3/go.mod: -------------------------------------------------------------------------------- 1 | module factorial.go 2 | 3 | require github.com/onsi/gomega v1.7.1 4 | 5 | require ( 6 | golang.org/x/text v0.7.0 // indirect 7 | gopkg.in/yaml.v2 v2.2.8 // indirect 8 | ) 9 | 10 | go 1.14 11 | -------------------------------------------------------------------------------- /article_45/factorial4/go.mod: -------------------------------------------------------------------------------- 1 | module factorial.go 2 | 3 | require github.com/onsi/gomega v1.7.1 4 | 5 | require gopkg.in/yaml.v2 v2.2.8 6 | 7 | go 1.14 8 | -------------------------------------------------------------------------------- /article_45/factorial5/go.mod: -------------------------------------------------------------------------------- 1 | module factorial.go 2 | 3 | require github.com/onsi/gomega v1.7.1 4 | 5 | require ( 6 | golang.org/x/text v0.7.0 // indirect 7 | gopkg.in/yaml.v2 v2.2.8 // indirect 8 | ) 9 | 10 | go 1.14 11 | -------------------------------------------------------------------------------- /article_45/iteration2/go.mod: -------------------------------------------------------------------------------- 1 | module factorial 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_45/iteration3/go.mod: -------------------------------------------------------------------------------- 1 | module factorial 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/onsi/ginkgo v1.10.3 7 | github.com/onsi/gomega v1.7.1 8 | ) 9 | -------------------------------------------------------------------------------- /article_45/iteration4/go.mod: -------------------------------------------------------------------------------- 1 | module factorial 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/onsi/ginkgo v1.10.3 7 | github.com/onsi/gomega v1.7.1 8 | ) 9 | -------------------------------------------------------------------------------- /article_45/iteration5/go.mod: -------------------------------------------------------------------------------- 1 | module factorial 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/onsi/ginkgo v1.10.3 7 | github.com/onsi/gomega v1.7.1 8 | ) 9 | -------------------------------------------------------------------------------- /article_45/iteration6/go.mod: -------------------------------------------------------------------------------- 1 | module factorial 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/onsi/ginkgo v1.10.3 7 | github.com/onsi/gomega v1.7.1 8 | ) 9 | -------------------------------------------------------------------------------- /article_45/iteration7/go.mod: -------------------------------------------------------------------------------- 1 | module factorial 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/onsi/ginkgo v1.10.3 7 | github.com/onsi/gomega v1.7.1 8 | ) 9 | -------------------------------------------------------------------------------- /article_45/maps/go.mod: -------------------------------------------------------------------------------- 1 | module factorial.go 2 | 3 | require github.com/onsi/gomega v1.7.1 4 | 5 | go 1.13 6 | -------------------------------------------------------------------------------- /article_46/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_46` 2 | 3 | -------------------------------------------------------------------------------- /article_46/minio01/go.mod: -------------------------------------------------------------------------------- 1 | module minio1 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio02/go.mod: -------------------------------------------------------------------------------- 1 | module minio2 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio03/go.mod: -------------------------------------------------------------------------------- 1 | module minio3 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio04/go.mod: -------------------------------------------------------------------------------- 1 | module minio4 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio05/go.mod: -------------------------------------------------------------------------------- 1 | module minio5 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio06/go.mod: -------------------------------------------------------------------------------- 1 | module minio6 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio07/go.mod: -------------------------------------------------------------------------------- 1 | module minio7 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio08/go.mod: -------------------------------------------------------------------------------- 1 | module minio8 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio09/go.mod: -------------------------------------------------------------------------------- 1 | module minio9 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_46/minio10/go.mod: -------------------------------------------------------------------------------- 1 | module minio10 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_47/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_47` 2 | 3 | * Examples used in the following article 4 | [Další možnosti nabízené projektem MinIO ](https://www.root.cz/clanky/dalsi-moznosti-nabizene-projektem-minio/) 5 | 6 | 1. 7 | -------------------------------------------------------------------------------- /article_47/minio11/go.mod: -------------------------------------------------------------------------------- 1 | module minio11 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_47/minio12/go.mod: -------------------------------------------------------------------------------- 1 | module minio12 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_47/minio13/go.mod: -------------------------------------------------------------------------------- 1 | module minio13 2 | 3 | go 1.13 4 | 5 | require github.com/minio/minio-go/v6 v6.0.44 6 | -------------------------------------------------------------------------------- /article_47/minio14/go.mod: -------------------------------------------------------------------------------- 1 | module minio14 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_47/minio15/go.mod: -------------------------------------------------------------------------------- 1 | module minio15 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_47/minio16/go.mod: -------------------------------------------------------------------------------- 1 | module minio16 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_47/minio17/go.mod: -------------------------------------------------------------------------------- 1 | module minio17 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/minio/minio-go/v6 v6.0.44 7 | golang.org/x/text v0.7.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_48/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_48` 2 | 3 | -------------------------------------------------------------------------------- /article_49/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_49` 2 | -------------------------------------------------------------------------------- /article_50/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_50` 2 | -------------------------------------------------------------------------------- /article_51/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_51` 2 | -------------------------------------------------------------------------------- /article_51/plotly01/plot.js: -------------------------------------------------------------------------------- 1 | var graphElement = document.getElementById('graphElement'); 2 | var data = { 3 | x: [1, 2, 3, 4, 5], 4 | y: [1, 2, 4, 8, 16] 5 | } 6 | var opts = { 7 | margin: { t: 0} 8 | } 9 | Plotly.plot(graphElement, [data], opts) 10 | -------------------------------------------------------------------------------- /article_51/plotly02/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "x": [1, 2, 3, 4, 5], 3 | "y": [1, 2, 4, 8, 16] 4 | } 5 | -------------------------------------------------------------------------------- /article_51/plotly02/plot.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $.getJSON("data.json", 3 | function (data) { 4 | var graphElement = $('#graphElement')[0]; 5 | var opts = { 6 | margin: { t: 0} 7 | }; 8 | Plotly.plot(graphElement, [data], opts); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /article_51/plotly03/plot.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $.getJSON("/data", 3 | function (data) { 4 | var graphElement = $('#graphElement')[0]; 5 | var opts = { 6 | margin: { t: 0} 7 | }; 8 | Plotly.plot(graphElement, [data], opts); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /article_51/plotly04/plot.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $.getJSON("/data", 3 | function (data) { 4 | var graphElement = $('#graphElement')[0]; 5 | var opts = { 6 | margin: { t: 0} 7 | }; 8 | Plotly.plot(graphElement, [data], opts); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /article_51/plotly05/plot.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $.getJSON("/data", 3 | function (data) { 4 | var graphElement = $('#graphElement')[0]; 5 | var opts = { 6 | margin: { t: 0} 7 | }; 8 | Plotly.plot(graphElement, [data], opts); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /article_52/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_52` 2 | -------------------------------------------------------------------------------- /article_53/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_53` 2 | -------------------------------------------------------------------------------- /article_53/add04/add_amd64.s: -------------------------------------------------------------------------------- 1 | TEXT ·add(SB),$0 2 | MOVQ $0x0, 0x18(SP) 3 | MOVQ 0x8(SP), AX 4 | ADDQ 0x10(SP), AX 5 | MOVQ AX, 0x18(SP) 6 | RET 7 | -------------------------------------------------------------------------------- /article_53/add04/go.mod: -------------------------------------------------------------------------------- 1 | module add 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_53/add05/add_amd64.s: -------------------------------------------------------------------------------- 1 | TEXT ·add(SB),$0 2 | MOVQ x+8(SP), AX 3 | ADDQ y+16(SP), AX 4 | MOVQ AX, 24(SP) 5 | RET 6 | -------------------------------------------------------------------------------- /article_53/add05/go.mod: -------------------------------------------------------------------------------- 1 | module add 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_53/add06/add_amd64.s: -------------------------------------------------------------------------------- 1 | TEXT ·add(SB),$0 2 | MOVQ x+0(FP), AX 3 | ADDQ y+8(FP), AX 4 | MOVQ AX, 0x18(SP) 5 | RET 6 | -------------------------------------------------------------------------------- /article_53/add06/go.mod: -------------------------------------------------------------------------------- 1 | module add 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_53/add07/add_amd64.s: -------------------------------------------------------------------------------- 1 | TEXT ·add(SB),$0 2 | MOVQ x+0(FP), AX 3 | ADDQ y+8(FP), AX 4 | MOVQ AX, result+16(FP) 5 | RET 6 | -------------------------------------------------------------------------------- /article_53/add07/go.mod: -------------------------------------------------------------------------------- 1 | module add 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_53/add08/add_amd64.s: -------------------------------------------------------------------------------- 1 | TEXT ·add(SB),$0 2 | MOVQ x+0(FP), AX 3 | ADDQ y+8(FP), AX 4 | MOVQ AX, result+16(FP) 5 | RET 6 | -------------------------------------------------------------------------------- /article_53/add08/add_arm.s: -------------------------------------------------------------------------------- 1 | TEXT ·add(SB),$0 2 | MOVW 0x8(R13), R0 3 | MOVW 0x4(R13), R1 4 | ADD R0, R1, R0 5 | MOVW R0, 0xc(R13) 6 | ADD $0, R14, R15 7 | -------------------------------------------------------------------------------- /article_53/add08/go.mod: -------------------------------------------------------------------------------- 1 | module add 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_54/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_54` 2 | -------------------------------------------------------------------------------- /article_55/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_55` 2 | -------------------------------------------------------------------------------- /article_55/download_test_image.sh: -------------------------------------------------------------------------------- 1 | original_image_address="https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png" 2 | 3 | wget -v -O Lenna.png $original_image_address 4 | file Lenna.png 5 | -------------------------------------------------------------------------------- /article_56/02_empty_image_asm/go.mod: -------------------------------------------------------------------------------- 1 | module empty_image 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_56/03_empty_image_asm/go.mod: -------------------------------------------------------------------------------- 1 | module empty_image 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_56/04_empty_image_asm/go.mod: -------------------------------------------------------------------------------- 1 | module empty_image 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_56/05_empty_image_asm/go.mod: -------------------------------------------------------------------------------- 1 | module empty_image 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /article_56/06_empty_image_go_memset/go.mod: -------------------------------------------------------------------------------- 1 | module empty_image 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/tmthrgd/go-memset v0.0.0-20190904060434-6fb7a21f88f1 7 | golang.org/x/sys v0.1.0 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_56/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_56` 2 | -------------------------------------------------------------------------------- /article_57/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_57` 2 | -------------------------------------------------------------------------------- /article_58/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_58` 2 | -------------------------------------------------------------------------------- /article_58/bson_decode_pprint.py: -------------------------------------------------------------------------------- 1 | import pprint 2 | import bson 3 | 4 | with open("tree.bson", "rb") as fin: 5 | content = fin.read() 6 | binary_tree = bson.loads(content) 7 | pp = pprint.PrettyPrinter(indent=4) 8 | pp.pprint(binary_tree) 9 | -------------------------------------------------------------------------------- /article_59/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_59` 2 | -------------------------------------------------------------------------------- /article_59/Test2.java: -------------------------------------------------------------------------------- 1 | import java.util.List; 2 | import java.util.ArrayList; 3 | import java.awt.Color; 4 | 5 | public class Test2 { 6 | public static void main(String[] args) { 7 | List l = new ArrayList(); 8 | l.add("foo"); 9 | l.add("bar"); 10 | l.add("baz"); 11 | 12 | String s = l.get(0); 13 | System.out.println(s.length()); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /article_59/Test3.java: -------------------------------------------------------------------------------- 1 | import java.util.List; 2 | import java.util.ArrayList; 3 | import java.awt.Color; 4 | 5 | public class Test3 { 6 | public static void main(String[] args) { 7 | List l = new ArrayList(); 8 | l.add("foo"); 9 | l.add("bar"); 10 | l.add("baz"); 11 | 12 | String s = (String)l.get(0); 13 | System.out.println(s.length()); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /article_61/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_61` 2 | -------------------------------------------------------------------------------- /article_61/c/test1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_61/c/test1.bmp -------------------------------------------------------------------------------- /article_61/go/test1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_61/go/test1.bmp -------------------------------------------------------------------------------- /article_62/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_62` 2 | -------------------------------------------------------------------------------- /article_62/c/globe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_62/c/globe.png -------------------------------------------------------------------------------- /article_62/c/test1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_62/c/test1.bmp -------------------------------------------------------------------------------- /article_62/go/globe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_62/go/globe.png -------------------------------------------------------------------------------- /article_62/go/test1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_62/go/test1.bmp -------------------------------------------------------------------------------- /article_63/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_63` 2 | -------------------------------------------------------------------------------- /article_63/globe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_63/globe.png -------------------------------------------------------------------------------- /article_64/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_64` 2 | -------------------------------------------------------------------------------- /article_64/globe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_64/globe.png -------------------------------------------------------------------------------- /article_65/01_new_client/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/02_ping_pong/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/03_connection_string/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/04_set_string/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/05_get_string/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/06_more_checks/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/07_set_expiration/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/08_incr/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/09_decr/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/10_float/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/11_list/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/12_queue/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/13_reverse_queue/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/14_message_broker/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/15_session/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_65/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_65` 2 | -------------------------------------------------------------------------------- /article_66/01_session/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_66/02_pub_sub/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_66/03_pub_more_sub/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_66/04_pub_sub_channel/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_66/05_pipeline/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_66/06_script/go.mod: -------------------------------------------------------------------------------- 1 | module redis1 2 | 3 | go 1.13 4 | 5 | require github.com/go-redis/redis/v8 v8.0.0-beta.5 6 | -------------------------------------------------------------------------------- /article_66/06_script/script.lua: -------------------------------------------------------------------------------- 1 | if redis.call("GET", KEYS[1]) ~= false then 2 | return redis.call("INCRBY", KEYS[1], ARGV[1]) 3 | end 4 | return false 5 | -------------------------------------------------------------------------------- /article_66/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_66` 2 | -------------------------------------------------------------------------------- /article_67/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_67` 2 | -------------------------------------------------------------------------------- /article_67/go.mod: -------------------------------------------------------------------------------- 1 | module t 2 | 3 | go 1.13 4 | 5 | require github.com/tealeg/xlsx/v3 v3.2.0 6 | -------------------------------------------------------------------------------- /article_68/01-parquet-generator/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/02-parquet-reader/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/03-bool-values/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/04-int-values/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/05-int-values-packed/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/06-compression/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/07-strings/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/08-dictionaries/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/09-write-performance/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/bxcodec/faker/v3 v3.5.0 7 | github.com/xitongsys/parquet-go v1.5.4 8 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 9 | ) 10 | -------------------------------------------------------------------------------- /article_68/10-read-performance/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_68/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_68` 2 | -------------------------------------------------------------------------------- /article_69/01-write-performance-by-records/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/bxcodec/faker/v3 v3.5.0 7 | github.com/xitongsys/parquet-go v1.5.4 8 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 9 | ) 10 | -------------------------------------------------------------------------------- /article_69/02-read-performance-by-records/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_69/03-read-performance-by-blocks/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_69/04-write-performance-by-records-pprof/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/bxcodec/faker/v3 v3.5.0 7 | github.com/xitongsys/parquet-go v1.5.4 8 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 9 | ) 10 | -------------------------------------------------------------------------------- /article_69/05-plot-read-performance-by-blocks/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_69/06-plot-read-performance-by-blocks-100-readers/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_69/07-plot-read-performance-by-block-N-readers/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_69/08-read-performance-by-column-index/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_69/09-read-performance-by-column-path/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_69/10-plot-read-performance-by-column-index/go.mod: -------------------------------------------------------------------------------- 1 | module parquet-generator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/xitongsys/parquet-go v1.5.4 7 | github.com/xitongsys/parquet-go-source v0.0.0-20201108113611-f372b7d813be 8 | ) 9 | -------------------------------------------------------------------------------- /article_69/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_69` 2 | -------------------------------------------------------------------------------- /article_70/README.md: -------------------------------------------------------------------------------- 1 | # Content of the subdirectory `article_70` 2 | 3 | * This article is part of the serie about Go programming language 4 | [Programovací jazyk Go](https://www.root.cz/serialy/programovaci-jazyk-go/) 5 | 6 | -------------------------------------------------------------------------------- /article_71/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_71/README.md -------------------------------------------------------------------------------- /article_71/go-pretty-test/go.mod: -------------------------------------------------------------------------------- 1 | module go-pretty-test 2 | 3 | go 1.14 4 | 5 | require ( 6 | github.com/go-openapi/strfmt v0.20.0 // indirect 7 | github.com/jedib0t/go-pretty v4.3.0+incompatible 8 | github.com/jedib0t/go-pretty/v6 v6.1.0 9 | ) 10 | -------------------------------------------------------------------------------- /article_72/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_72/README.md -------------------------------------------------------------------------------- /article_72/go.mod: -------------------------------------------------------------------------------- 1 | module db-test 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/DATA-DOG/go-sqlmock v1.5.0 7 | github.com/lib/pq v1.10.0 8 | github.com/mattn/go-sqlite3 v2.0.3+incompatible 9 | github.com/rs/zerolog v1.20.0 10 | ) 11 | -------------------------------------------------------------------------------- /article_73/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_73/README.md -------------------------------------------------------------------------------- /article_73/go.mod: -------------------------------------------------------------------------------- 1 | module db-test 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/DATA-DOG/go-sqlmock v1.5.0 7 | github.com/lib/pq v1.10.0 8 | github.com/mattn/go-sqlite3 v2.0.3+incompatible 9 | github.com/rs/zerolog v1.20.0 10 | ) 11 | -------------------------------------------------------------------------------- /article_74/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_74/README.md -------------------------------------------------------------------------------- /article_74/diagram1.dot: -------------------------------------------------------------------------------- 1 | digraph root { 2 | fontcolor="#2D3436"; 3 | fontname="Sans-Serif"; 4 | fontsize=13; 5 | label="Diagram #1"; 6 | nodesep=0.6; 7 | pad=2; 8 | rankdir=LR; 9 | ranksep=0.75; 10 | splines=ortho; 11 | } 12 | -------------------------------------------------------------------------------- /article_75/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_75/README.md -------------------------------------------------------------------------------- /article_75/sarama-consumer-2/go.mod: -------------------------------------------------------------------------------- 1 | module sarama-consumer-2 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/Shopify/sarama v1.29.0 7 | github.com/google/uuid v1.2.0 8 | github.com/rs/zerolog v1.22.0 9 | ) 10 | -------------------------------------------------------------------------------- /article_75/sarama-consumer/go.mod: -------------------------------------------------------------------------------- 1 | module sarama-consumer 2 | 3 | go 1.13 4 | 5 | require github.com/Shopify/sarama v1.29.0 6 | -------------------------------------------------------------------------------- /article_75/sarama-list-topics/go.mod: -------------------------------------------------------------------------------- 1 | module sarama-list-topics 2 | 3 | go 1.13 4 | 5 | require github.com/Shopify/sarama v1.29.0 6 | -------------------------------------------------------------------------------- /article_75/sarama-producer-2/go.mod: -------------------------------------------------------------------------------- 1 | module sarama-producer-2 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/RedHatInsights/ccx-notification-service v0.0.0-20210610152504-b61d62fd903b 7 | github.com/Shopify/sarama v1.29.0 8 | github.com/rs/zerolog v1.22.0 9 | ) 10 | -------------------------------------------------------------------------------- /article_75/sarama-producer/go.mod: -------------------------------------------------------------------------------- 1 | module sarama-producer 2 | 3 | go 1.13 4 | 5 | require github.com/Shopify/sarama v1.29.0 6 | -------------------------------------------------------------------------------- /article_76/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_76/README.md -------------------------------------------------------------------------------- /article_76/aurora/01-basic-usage/go.mod: -------------------------------------------------------------------------------- 1 | module 01-basic-usage 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/02-disable-colors/go.mod: -------------------------------------------------------------------------------- 1 | module 02-disable-colors 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/03-colors-flag/go.mod: -------------------------------------------------------------------------------- 1 | module 03-colors-flag 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/04-bold-attribute/go.mod: -------------------------------------------------------------------------------- 1 | module 04-bold-attribute 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/05-bold-attribute-B/go.mod: -------------------------------------------------------------------------------- 1 | module 05-bold-attribute-B 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/06-background-colors/go.mod: -------------------------------------------------------------------------------- 1 | module 06-background-colors 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/07-grayscale-foreground/go.mod: -------------------------------------------------------------------------------- 1 | module 07-grayscale-foreground 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/08-grayscale-background/go.mod: -------------------------------------------------------------------------------- 1 | module 08-grayscale-background 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/09-grayscale-fg-and-bg/go.mod: -------------------------------------------------------------------------------- 1 | module 09-grayscale-fg-and-bg 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/aurora/10-8-bit-colors/go.mod: -------------------------------------------------------------------------------- 1 | module 10-8-bit-colors 2 | 3 | go 1.13 4 | 5 | require github.com/logrusorgru/aurora v2.0.3+incompatible 6 | -------------------------------------------------------------------------------- /article_76/zerolog/01-basic-usage/go.mod: -------------------------------------------------------------------------------- 1 | module 01-basic-usage 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/02-output-to-stdout/go.mod: -------------------------------------------------------------------------------- 1 | module 02-output-to-stdout 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/03-output-to-stderr/go.mod: -------------------------------------------------------------------------------- 1 | module 03-output-to-stderr 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/04-chaining/go.mod: -------------------------------------------------------------------------------- 1 | module 04-chaining 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/05-errors/go.mod: -------------------------------------------------------------------------------- 1 | module 05-errors 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/06-levels/go.mod: -------------------------------------------------------------------------------- 1 | module 06-levels 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/07-set-level/go.mod: -------------------------------------------------------------------------------- 1 | module 07-set-level 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/08-no-level/go.mod: -------------------------------------------------------------------------------- 1 | module 08-no-level 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/09-format-message/go.mod: -------------------------------------------------------------------------------- 1 | module 09-format-message 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_76/zerolog/10-different-output/go.mod: -------------------------------------------------------------------------------- 1 | module 10-different-output 2 | 3 | go 1.13 4 | 5 | require github.com/rs/zerolog v1.23.0 6 | -------------------------------------------------------------------------------- /article_77/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_77/README.md -------------------------------------------------------------------------------- /article_78/01_hello_world/go.mod: -------------------------------------------------------------------------------- 1 | module 01_hello_world 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/01_hello_world/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/02_arithmetic/go.mod: -------------------------------------------------------------------------------- 1 | module 02_arithmetic 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/02_arithmetic/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/03_priority/go.mod: -------------------------------------------------------------------------------- 1 | module 03_priority 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/03_priority/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/04_no_constants/go.mod: -------------------------------------------------------------------------------- 1 | module 04_no_constants 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/04_no_constants/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/05_constants/go.mod: -------------------------------------------------------------------------------- 1 | module 05_constants 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/05_constants/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/06_more_constants/go.mod: -------------------------------------------------------------------------------- 1 | module 06_more_constants 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/06_more_constants/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/07_boolean_expression/go.mod: -------------------------------------------------------------------------------- 1 | module 07_boolean_expression 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/07_boolean_expression/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/08_boolean_expression/go.mod: -------------------------------------------------------------------------------- 1 | module 08_boolean_expression 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/08_boolean_expression/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/09_ternary_operator/go.mod: -------------------------------------------------------------------------------- 1 | module 09_ternary_operator 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/09_ternary_operator/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/10_ternary_operator/go.mod: -------------------------------------------------------------------------------- 1 | module 10_ternary_operator 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/10_ternary_operator/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/11_array_indexing/go.mod: -------------------------------------------------------------------------------- 1 | module 11_array_indexing 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/11_array_indexing/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/12_struct_selector/go.mod: -------------------------------------------------------------------------------- 1 | module 12_struct_selector 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/12_struct_selector/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/13_array_indexing_by_parameter/go.mod: -------------------------------------------------------------------------------- 1 | module 13_array_indexing_by_parameter 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/13_array_indexing_by_parameter/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/14_struct_selector_by_parameter/go.mod: -------------------------------------------------------------------------------- 1 | module 14_struct_selector_by_parameter 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/14_struct_selector_by_parameter/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/15_dot_selector/go.mod: -------------------------------------------------------------------------------- 1 | module 15_dot_selector 2 | 3 | go 1.14 4 | 5 | require github.com/PaesslerAG/gval v1.1.1 6 | -------------------------------------------------------------------------------- /article_78/15_dot_selector/go.sum: -------------------------------------------------------------------------------- 1 | github.com/PaesslerAG/gval v1.1.1 h1:4d7pprU9876+m3rc08X33UjGip8oV1kkm8Gh5GBuTss= 2 | github.com/PaesslerAG/gval v1.1.1/go.mod h1:Fa8gfkCmUsELXgayr8sfL/sw+VzCVoa03dcOcR/if2w= 3 | github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= 4 | -------------------------------------------------------------------------------- /article_78/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_78/README.md -------------------------------------------------------------------------------- /article_79/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_79/README.md -------------------------------------------------------------------------------- /article_79/template13.txt: -------------------------------------------------------------------------------- 1 | {{range .}}Jméno {{.Name}} {{.Surname}} 2 | Popularita {{.Popularity}} 3 | --- 4 | {{end}} 5 | -------------------------------------------------------------------------------- /article_79/template14.txt: -------------------------------------------------------------------------------- 1 | {{range .}}Jméno {{.Name}} {{.Surname}} 2 | Popularita {{.Popularity}} 3 | --- 4 | {{end}} 5 | -------------------------------------------------------------------------------- /article_79/template15.txt: -------------------------------------------------------------------------------- 1 | {{range .}}Jméno {{.Name}} {{.Surname}} 2 | Popularita {{.Popularity}} 3 | --- 4 | {{end}} 5 | -------------------------------------------------------------------------------- /article_80/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_80/README.md -------------------------------------------------------------------------------- /article_80/template15.txt: -------------------------------------------------------------------------------- 1 | {{range .}}Jméno {{.Name}} {{.Surname}} 2 | Popularita {{.Popularity}} 3 | --- 4 | {{end}} 5 | -------------------------------------------------------------------------------- /article_80/template16.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} Popularita {{printf "%2d" .Popularity}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_80/template17.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} {{if gt .Popularity 0}} Popularita {{printf "%2d" .Popularity}} {{end}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_80/template18.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} Popularita {{if gt .Popularity 0}} {{printf "%2d" .Popularity}} {{else}} neznámá {{end}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_80/template19.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} Popularita {{.GetPopularity}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_80/template20.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} Popularita {{.getPopularity}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_80/template21.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} Popularita {{.GetPopularity | printf "%10s"}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_80/template22.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} Popularita {{with $x := .GetPopularity}}{{printf "%10s" $x}}{{end}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_80/template23.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} Popularita {{with $x := .GetPopularity}}{{$x | printf "%10s"}}{{end}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_82/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_82/README.md -------------------------------------------------------------------------------- /article_83/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_83/README.md -------------------------------------------------------------------------------- /article_84/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_84/README.md -------------------------------------------------------------------------------- /article_85/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_85/README.md -------------------------------------------------------------------------------- /article_85/so1.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | import "fmt" 5 | 6 | //export hello 7 | func hello() { 8 | fmt.Println("Hello, world!") 9 | } 10 | 11 | func main() {} 12 | -------------------------------------------------------------------------------- /article_85/so2.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | import "fmt" 5 | 6 | //export hello 7 | func hello() { 8 | fmt.Println("Hello, world!") 9 | } 10 | 11 | func init() { 12 | fmt.Println("init") 13 | } 14 | 15 | func main() { 16 | hello() 17 | } 18 | -------------------------------------------------------------------------------- /article_85/so3.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | 5 | //export add 6 | func add(x, y int) int { 7 | return x + y 8 | } 9 | 10 | func main() {} 11 | -------------------------------------------------------------------------------- /article_85/so4.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | 5 | import "fmt" 6 | 7 | //export add 8 | func add(x, y int64) int64 { 9 | result := x + y 10 | fmt.Printf("Called add(%d, %d) with result %d\n", x, y, result) 11 | return result 12 | } 13 | 14 | func main() {} 15 | -------------------------------------------------------------------------------- /article_85/so5.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | 5 | import "fmt" 6 | 7 | //export hello 8 | func hello(name string) int { 9 | fmt.Printf("Hello %s\n", name) 10 | return len(name) 11 | } 12 | 13 | func main() {} 14 | -------------------------------------------------------------------------------- /article_85/so6.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | 5 | import "fmt" 6 | 7 | //export hello 8 | func hello(name *C.char) int { 9 | goName := C.GoString(name) 10 | fmt.Printf("Hello %s\n", goName) 11 | return len(goName) 12 | } 13 | 14 | func main() {} 15 | -------------------------------------------------------------------------------- /article_85/so7.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | 5 | //export concat 6 | func concat(text1, text2 *C.char) *C.char { 7 | t1 := C.GoString(text1) 8 | t2 := C.GoString(text2) 9 | 10 | result := t1 + t2 11 | return C.CString(result) 12 | } 13 | 14 | func main() {} 15 | -------------------------------------------------------------------------------- /article_85/use_so1A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so1 = ctypes.CDLL("so1.so") 4 | 5 | so1.hello() 6 | -------------------------------------------------------------------------------- /article_85/use_so1B.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so1 = ctypes.CDLL("./so1.so") 4 | 5 | so1.hello() 6 | -------------------------------------------------------------------------------- /article_85/use_so2A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so2 = ctypes.CDLL("so2.so") 4 | 5 | so2.hello() 6 | -------------------------------------------------------------------------------- /article_85/use_so2B.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so2 = ctypes.CDLL("./so2.so") 4 | 5 | so2.hello() 6 | -------------------------------------------------------------------------------- /article_85/use_so3A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so3 = ctypes.CDLL("./so3.so") 4 | 5 | a = 1 6 | b = 2 7 | 8 | c = so3.add(a, b) 9 | print(c) 10 | -------------------------------------------------------------------------------- /article_85/use_so3B.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so3 = ctypes.CDLL("./so3.so") 4 | 5 | a = 1.2 6 | b = 3.4 7 | 8 | c = so3.add(a, b) 9 | print(c) 10 | -------------------------------------------------------------------------------- /article_85/use_so3C.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so3 = ctypes.CDLL("./so3.so") 4 | 5 | a = 1 6 | b = 10000000000000000 7 | 8 | c = so3.add(a, b) 9 | print(c) 10 | -------------------------------------------------------------------------------- /article_85/use_so4A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so4 = ctypes.CDLL("./so4.so") 4 | 5 | a = 1 6 | b = 2 7 | 8 | c = so4.add(a, b) 9 | print(c) 10 | -------------------------------------------------------------------------------- /article_85/use_so4B.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so4 = ctypes.CDLL("./so4.so") 4 | 5 | a = 2**31-1 6 | b = 1 7 | 8 | c = so4.add(a, b) 9 | print(c) 10 | -------------------------------------------------------------------------------- /article_85/use_so4C.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so4 = ctypes.CDLL("./so4.so") 4 | 5 | a = 2**31-1 6 | b = 1 7 | 8 | so4.add.restype = ctypes.c_int64 9 | 10 | c = so4.add(a, b) 11 | print(c) 12 | -------------------------------------------------------------------------------- /article_85/use_so5A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so5 = ctypes.CDLL("./so5.so") 4 | 5 | l = so5.hello("World!") 6 | print(l) 7 | -------------------------------------------------------------------------------- /article_85/use_so6A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so6 = ctypes.CDLL("./so6.so") 4 | 5 | l = so6.hello("World!") 6 | print(l) 7 | -------------------------------------------------------------------------------- /article_85/use_so6B.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so6 = ctypes.CDLL("./so6.so") 4 | 5 | l = so6.hello("World!".encode("utf-8")) 6 | print(l) 7 | -------------------------------------------------------------------------------- /article_85/use_so6C.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so6 = ctypes.CDLL("./so6.so") 4 | 5 | l = so6.hello("ěščř ЩжΛλ".encode("utf-8")) 6 | print(l) 7 | -------------------------------------------------------------------------------- /article_85/use_so7A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so7 = ctypes.CDLL("./so7.so") 4 | 5 | t1 = "ěščř ЩжΛλ".encode("utf-8") 6 | t2 = "".encode("utf-8") 7 | 8 | so7.concat.restype = ctypes.c_char_p 9 | 10 | t = so7.concat(t1, t2) 11 | print(t) 12 | -------------------------------------------------------------------------------- /article_85/use_so7B.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so7 = ctypes.CDLL("./so7.so") 4 | 5 | t1 = "ěščř ЩжΛλ".encode("utf-8") 6 | t2 = "".encode("utf-8") 7 | 8 | so7.concat.restype = ctypes.c_char_p 9 | 10 | t = so7.concat(t1, t2) 11 | print(t.decode("utf-8")) 12 | -------------------------------------------------------------------------------- /article_85/use_so7C.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | import time 3 | 4 | so7 = ctypes.CDLL("./so7.so") 5 | 6 | t1 = ("ěščř ЩжΛλ"*10000).encode("utf-8") 7 | t2 = (""*10000).encode("utf-8") 8 | 9 | so7.concat.restype = ctypes.c_char_p 10 | 11 | for i in range(100000): 12 | t = so7.concat(t1, t2) 13 | print(len(t)) 14 | time.sleep(0.001) 15 | -------------------------------------------------------------------------------- /article_86/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_86/README.md -------------------------------------------------------------------------------- /article_86/so10.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | import "unsafe" 5 | 6 | //export average 7 | func average(values *C.double, length int) float64 { 8 | if length == 0 { 9 | return -1 10 | } 11 | 12 | var sum float64 = 0 13 | slice := unsafe.Slice(values, length) 14 | for _, value := range slice { 15 | sum += float64(value) 16 | } 17 | return sum / float64(length) 18 | } 19 | 20 | func main() {} 21 | -------------------------------------------------------------------------------- /article_86/so11.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "math" 4 | import "fmt" 5 | 6 | /* 7 | struct Vector { 8 | double X; 9 | double Y; 10 | }; 11 | */ 12 | import "C" 13 | 14 | //export length 15 | func length(v C.struct_Vector) C.double { 16 | r := C.double(math.Sqrt(float64(v.X*v.X) + float64(v.Y*v.Y))) 17 | fmt.Printf("%f %f %f\n", float64(v.X), float64(v.Y), r) 18 | return r 19 | } 20 | 21 | func main() {} 22 | -------------------------------------------------------------------------------- /article_86/so9.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "C" 4 | import "unsafe" 5 | 6 | //export sum 7 | func sum(values *C.int, length int) int64 { 8 | var sum int64 = 0 9 | slice := unsafe.Slice(values, length) 10 | for _, value := range slice { 11 | sum += int64(value) 12 | } 13 | return sum 14 | } 15 | 16 | func main() {} 17 | -------------------------------------------------------------------------------- /article_86/use_so11.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so11 = ctypes.CDLL("./so11.so") 4 | 5 | so11.length.restype = ctypes.c_double 6 | 7 | class Vector(ctypes.Structure): 8 | _fields_ = [("X", ctypes.c_double), 9 | ("Y", ctypes.c_double)] 10 | 11 | v = Vector(1.0, 1.0) 12 | 13 | print(so11.length(v)) 14 | -------------------------------------------------------------------------------- /article_86/use_so8A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so8 = ctypes.CDLL("./so8.so") 4 | 5 | t1 = "ěščř ЩжΛλ".encode("utf-8") 6 | t2 = "".encode("utf-8") 7 | 8 | so8.concat.restype = ctypes.POINTER(ctypes.c_char) 9 | 10 | ptr = so8.concat(t1, t2) 11 | val = ctypes.cast(ptr, ctypes.c_char_p).value 12 | print(val.decode("utf-8")) 13 | so8.freeString(ptr) 14 | -------------------------------------------------------------------------------- /article_86/use_so8C.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | import time 3 | 4 | so8 = ctypes.CDLL("./so8.so") 5 | 6 | t1 = ("ěščř ЩжΛλ"*10000).encode("utf-8") 7 | t2 = (""*10000).encode("utf-8") 8 | 9 | so8.concat.restype = ctypes.POINTER(ctypes.c_char) 10 | 11 | for i in range(100000): 12 | ptr = so8.concat(t1, t2) 13 | val = ctypes.cast(ptr, ctypes.c_char_p).value 14 | print(len(val)) 15 | time.sleep(0.001) 16 | -------------------------------------------------------------------------------- /article_86/use_so9A.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so9 = ctypes.CDLL("./so9.so") 4 | 5 | IntArray = ctypes.c_int * 4 6 | array = IntArray(1, 2, 3, 4) 7 | 8 | so9.sum.restype = ctypes.c_int64 9 | 10 | print(so9.sum(array, 4)) 11 | -------------------------------------------------------------------------------- /article_86/use_so9B.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | 3 | so9 = ctypes.CDLL("./so9.so") 4 | 5 | values = [1, 2, 3, 4, 5] 6 | 7 | IntArray = ctypes.c_int * len(values) 8 | array = IntArray(*values) 9 | 10 | so9.sum.restype = ctypes.c_int64 11 | 12 | print(so9.sum(array, 4)) 13 | -------------------------------------------------------------------------------- /article_87/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_87/README.md -------------------------------------------------------------------------------- /article_87/benchmark/bench.txt: -------------------------------------------------------------------------------- 1 | goos: linux 2 | goarch: amd64 3 | pkg: template 4 | cpu: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 5 | BenchmarkReadTemplate-8 44815 26499 ns/op 6 | BenchmarkApplyTemplate-8 22891 53443 ns/op 7 | BenchmarkReadAndApplyTemplate-8 10000 122381 ns/op 8 | PASS 9 | ok template 4.451s 10 | -------------------------------------------------------------------------------- /article_87/benchmark/go.mod: -------------------------------------------------------------------------------- 1 | module template 2 | 3 | go 1.17 4 | -------------------------------------------------------------------------------- /article_87/fsnotify/go.mod: -------------------------------------------------------------------------------- 1 | module fsnotify-test 2 | 3 | go 1.17 4 | 5 | require github.com/fsnotify/fsnotify v1.5.1 6 | 7 | require golang.org/x/sys v0.1.0 // indirect 8 | -------------------------------------------------------------------------------- /article_87/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test 4 | 5 | 6 | 7 | 8 |

Test

9 | 10 | 11 | -------------------------------------------------------------------------------- /article_87/template_pages3/go.mod: -------------------------------------------------------------------------------- 1 | module template-pages-3 2 | 3 | go 1.17 4 | 5 | require github.com/fsnotify/fsnotify v1.5.1 6 | 7 | require golang.org/x/sys v0.1.0 // indirect 8 | -------------------------------------------------------------------------------- /article_87/text_template01.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | {{range .}}Jméno {{printf "%-15s" .Name}} {{printf "%-15s" .Surname}} {{if gt .Popularity 0}} Popularita {{printf "%2d" .Popularity}} {{end}} 3 | {{end}} 4 | -------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /article_88/01_print.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func printValue(value string) { 6 | fmt.Println(value) 7 | } 8 | 9 | func main() { 10 | printValue("www.root.cz") 11 | } 12 | -------------------------------------------------------------------------------- /article_88/02_print_overload.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func printValue(value string) { 6 | fmt.Println(value) 7 | } 8 | 9 | func printValue(value int) { 10 | fmt.Println(value) 11 | } 12 | 13 | func main() { 14 | printValue("www.root.cz") 15 | } 16 | -------------------------------------------------------------------------------- /article_88/03_print_no_conversion.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | type Value string 6 | 7 | func printValue(value Value) { 8 | fmt.Println(value) 9 | } 10 | 11 | func main() { 12 | v := "www.root.cz" // string 13 | printValue(v) 14 | } 15 | -------------------------------------------------------------------------------- /article_88/04_print_interface.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func printValue(value interface{}) { 6 | fmt.Println(value) 7 | } 8 | 9 | func main() { 10 | printValue("www.root.cz") 11 | printValue('*') 12 | printValue(42) 13 | printValue(3.14) 14 | printValue(1 + 2i) 15 | printValue([]int{1, 2, 3}) 16 | } 17 | -------------------------------------------------------------------------------- /article_88/05_generic_print.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func printValue[T any](value T) { 6 | fmt.Println(value) 7 | } 8 | 9 | func main() { 10 | printValue("www.root.cz") 11 | printValue('*') 12 | printValue(42) 13 | printValue(3.14) 14 | printValue(1 + 2i) 15 | printValue([]int{1, 2, 3}) 16 | } 17 | -------------------------------------------------------------------------------- /article_88/06_type_parameter.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func printValue[T any](value T) { 6 | fmt.Println(value) 7 | } 8 | 9 | func main() { 10 | printValue[string]("www.root.cz") 11 | printValue[rune]('*') 12 | printValue[int](42) 13 | printValue[float32](3.14) 14 | printValue[complex64](1 + 2i) 15 | printValue[[]int]([]int{1, 2, 3}) 16 | } 17 | -------------------------------------------------------------------------------- /article_88/07_type_parameter_check.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func printValue[T any](value T) { 6 | fmt.Println(value) 7 | } 8 | 9 | func main() { 10 | printValue[int]("www.root.cz") 11 | printValue[[]string]('*') 12 | printValue[string](42) 13 | printValue[int](3.14) 14 | printValue[byte](1 + 2i) 15 | printValue[[]byte]([]int{1, 2, 3}) 16 | } 17 | -------------------------------------------------------------------------------- /article_88/08_comparable.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func compare(x int, y int) bool { 6 | return x < y 7 | } 8 | 9 | func main() { 10 | fmt.Println(compare(1, 2)) 11 | } 12 | -------------------------------------------------------------------------------- /article_88/10_compare_type_parameters.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | type comparable interface { 6 | int | float64 | string 7 | } 8 | 9 | func compare[T comparable](x T, y T) bool { 10 | return x < y 11 | } 12 | 13 | func main() { 14 | fmt.Println(compare(1, 2)) 15 | fmt.Println(compare(1.5, 2.6)) 16 | fmt.Println(compare("foo", "bar")) 17 | } 18 | -------------------------------------------------------------------------------- /article_88/11_add_int.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func add(x int, y int) int { 6 | return x + y 7 | } 8 | 9 | func main() { 10 | fmt.Println(add(1, 2)) 11 | } 12 | -------------------------------------------------------------------------------- /article_88/12_add_type_parameters.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | type numeric interface { 6 | int | float64 | complex128 7 | } 8 | 9 | func add[T numeric](x T, y T) T { 10 | return x + y 11 | } 12 | 13 | func main() { 14 | fmt.Println(add(1, 2)) 15 | fmt.Println(add(1.5, 2.6)) 16 | fmt.Println(add(1i, 2+4i)) 17 | } 18 | -------------------------------------------------------------------------------- /article_88/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_88/README.md -------------------------------------------------------------------------------- /article_89/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_89/README.md -------------------------------------------------------------------------------- /article_90/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_90/README.md -------------------------------------------------------------------------------- /article_90/flow1/go.mod: -------------------------------------------------------------------------------- 1 | module flow1 2 | 3 | go 1.18 4 | 5 | require github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 6 | -------------------------------------------------------------------------------- /article_90/flow1/go.sum: -------------------------------------------------------------------------------- 1 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 h1:Wg/FBcKQtlJfUfOGNMugkQhHYUtlUm/GlMDCKObja7o= 2 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2/go.mod h1:ZwcUORj/boS7D5glapIfMUA3ZxB61hWKdb672oXyJa8= 3 | -------------------------------------------------------------------------------- /article_90/flow2/go.mod: -------------------------------------------------------------------------------- 1 | module flow2 2 | 3 | go 1.18 4 | 5 | require github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 // indirect 6 | -------------------------------------------------------------------------------- /article_90/flow2/go.sum: -------------------------------------------------------------------------------- 1 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 h1:Wg/FBcKQtlJfUfOGNMugkQhHYUtlUm/GlMDCKObja7o= 2 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2/go.mod h1:ZwcUORj/boS7D5glapIfMUA3ZxB61hWKdb672oXyJa8= 3 | -------------------------------------------------------------------------------- /article_90/flow3/go.mod: -------------------------------------------------------------------------------- 1 | module flow3 2 | 3 | go 1.18 4 | 5 | require github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 // indirect 6 | -------------------------------------------------------------------------------- /article_90/flow3/go.sum: -------------------------------------------------------------------------------- 1 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 h1:Wg/FBcKQtlJfUfOGNMugkQhHYUtlUm/GlMDCKObja7o= 2 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2/go.mod h1:ZwcUORj/boS7D5glapIfMUA3ZxB61hWKdb672oXyJa8= 3 | -------------------------------------------------------------------------------- /article_90/flow4/go.mod: -------------------------------------------------------------------------------- 1 | module flow4 2 | 3 | go 1.18 4 | 5 | require github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 // indirect 6 | -------------------------------------------------------------------------------- /article_90/flow4/go.sum: -------------------------------------------------------------------------------- 1 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 h1:Wg/FBcKQtlJfUfOGNMugkQhHYUtlUm/GlMDCKObja7o= 2 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2/go.mod h1:ZwcUORj/boS7D5glapIfMUA3ZxB61hWKdb672oXyJa8= 3 | -------------------------------------------------------------------------------- /article_90/flow5/go.mod: -------------------------------------------------------------------------------- 1 | module flow5 2 | 3 | go 1.18 4 | 5 | require github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 // indirect 6 | -------------------------------------------------------------------------------- /article_90/flow5/go.sum: -------------------------------------------------------------------------------- 1 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 h1:Wg/FBcKQtlJfUfOGNMugkQhHYUtlUm/GlMDCKObja7o= 2 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2/go.mod h1:ZwcUORj/boS7D5glapIfMUA3ZxB61hWKdb672oXyJa8= 3 | -------------------------------------------------------------------------------- /article_90/flow6/go.mod: -------------------------------------------------------------------------------- 1 | module flow6 2 | 3 | go 1.18 4 | 5 | require github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 // indirect 6 | -------------------------------------------------------------------------------- /article_90/flow6/go.sum: -------------------------------------------------------------------------------- 1 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 h1:Wg/FBcKQtlJfUfOGNMugkQhHYUtlUm/GlMDCKObja7o= 2 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2/go.mod h1:ZwcUORj/boS7D5glapIfMUA3ZxB61hWKdb672oXyJa8= 3 | -------------------------------------------------------------------------------- /article_90/flow7/go.mod: -------------------------------------------------------------------------------- 1 | module flow7 2 | 3 | go 1.18 4 | 5 | require github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 // indirect 6 | -------------------------------------------------------------------------------- /article_90/flow7/go.sum: -------------------------------------------------------------------------------- 1 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2 h1:Wg/FBcKQtlJfUfOGNMugkQhHYUtlUm/GlMDCKObja7o= 2 | github.com/trustmaster/goflow v0.0.0-20210928125717-b7d4fd465ab2/go.mod h1:ZwcUORj/boS7D5glapIfMUA3ZxB61hWKdb672oXyJa8= 3 | -------------------------------------------------------------------------------- /article_92/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_92/README.md -------------------------------------------------------------------------------- /article_92/go.mod: -------------------------------------------------------------------------------- 1 | module x 2 | 3 | go 1.18 4 | 5 | require github.com/daichi-m/go18ds v1.12.1 6 | -------------------------------------------------------------------------------- /article_92/go.sum: -------------------------------------------------------------------------------- 1 | github.com/daichi-m/go18ds v1.12.1 h1:Pjc3IApmN4qtDiovGP9MvMpIzgZle3SHUcNaA5j46bg= 2 | github.com/daichi-m/go18ds v1.12.1/go.mod h1:wc2dURUr8aMxxC4Mn5ObJGVM7uIKU8JagY4nhtonXq8= 3 | -------------------------------------------------------------------------------- /article_93/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_93/README.md -------------------------------------------------------------------------------- /article_93/benchmarks/go.mod: -------------------------------------------------------------------------------- 1 | module x 2 | 3 | go 1.18 4 | 5 | require github.com/daichi-m/go18ds v1.12.1 // indirect 6 | -------------------------------------------------------------------------------- /article_93/benchmarks/go.sum: -------------------------------------------------------------------------------- 1 | github.com/daichi-m/go18ds v1.12.1 h1:Pjc3IApmN4qtDiovGP9MvMpIzgZle3SHUcNaA5j46bg= 2 | github.com/daichi-m/go18ds v1.12.1/go.mod h1:wc2dURUr8aMxxC4Mn5ObJGVM7uIKU8JagY4nhtonXq8= 3 | -------------------------------------------------------------------------------- /article_93/go.mod: -------------------------------------------------------------------------------- 1 | module x 2 | 3 | go 1.18 4 | 5 | require github.com/daichi-m/go18ds v1.12.1 // indirect 6 | -------------------------------------------------------------------------------- /article_93/go.sum: -------------------------------------------------------------------------------- 1 | github.com/daichi-m/go18ds v1.12.1 h1:Pjc3IApmN4qtDiovGP9MvMpIzgZle3SHUcNaA5j46bg= 2 | github.com/daichi-m/go18ds v1.12.1/go.mod h1:wc2dURUr8aMxxC4Mn5ObJGVM7uIKU8JagY4nhtonXq8= 3 | -------------------------------------------------------------------------------- /article_93/lists_test.go: -------------------------------------------------------------------------------- 1 | /home/ptisnovs/src/go-root/article_93/benchmarks/lists_test.go -------------------------------------------------------------------------------- /article_93/tree_test.go: -------------------------------------------------------------------------------- 1 | /home/ptisnovs/src/go-root/article_93/benchmarks/tree_test.go -------------------------------------------------------------------------------- /article_94/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_94/README.md -------------------------------------------------------------------------------- /article_94/benchmarks/go.mod: -------------------------------------------------------------------------------- 1 | module x 2 | 3 | go 1.18 4 | 5 | require github.com/daichi-m/go18ds v1.12.1 // indirect 6 | -------------------------------------------------------------------------------- /article_94/benchmarks/go.sum: -------------------------------------------------------------------------------- 1 | github.com/daichi-m/go18ds v1.12.1 h1:Pjc3IApmN4qtDiovGP9MvMpIzgZle3SHUcNaA5j46bg= 2 | github.com/daichi-m/go18ds v1.12.1/go.mod h1:wc2dURUr8aMxxC4Mn5ObJGVM7uIKU8JagY4nhtonXq8= 3 | -------------------------------------------------------------------------------- /article_94/go.mod: -------------------------------------------------------------------------------- 1 | module x 2 | 3 | go 1.18 4 | 5 | require github.com/daichi-m/go18ds v1.12.1 // indirect 6 | -------------------------------------------------------------------------------- /article_94/go.sum: -------------------------------------------------------------------------------- 1 | github.com/daichi-m/go18ds v1.12.1 h1:Pjc3IApmN4qtDiovGP9MvMpIzgZle3SHUcNaA5j46bg= 2 | github.com/daichi-m/go18ds v1.12.1/go.mod h1:wc2dURUr8aMxxC4Mn5ObJGVM7uIKU8JagY4nhtonXq8= 3 | -------------------------------------------------------------------------------- /article_94/maps_test.go: -------------------------------------------------------------------------------- 1 | /home/ptisnovs/src/go-root/article_94/benchmarks/maps_test.go -------------------------------------------------------------------------------- /article_95/01_narray_na32.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na32" 7 | ) 8 | 9 | func main() { 10 | scalar := narray.New() 11 | vector := narray.New(10) 12 | matrix := narray.New(4, 3) 13 | cube := narray.New(3, 4, 5) 14 | 15 | fmt.Println(scalar) 16 | fmt.Println(vector) 17 | fmt.Println(matrix) 18 | fmt.Println(cube) 19 | } 20 | -------------------------------------------------------------------------------- /article_95/02_narray_na64.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | scalar := narray.New() 11 | vector := narray.New(10) 12 | matrix := narray.New(4, 3) 13 | cube := narray.New(3, 4, 5) 14 | 15 | fmt.Println(scalar) 16 | fmt.Println(vector) 17 | fmt.Println(matrix) 18 | fmt.Println(cube) 19 | } 20 | -------------------------------------------------------------------------------- /article_95/04_reshape.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | vector := narray.NewArray([]float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, 12) 11 | matrix := vector.Reshape(4, 3) 12 | 13 | fmt.Println(vector) 14 | fmt.Println(matrix) 15 | } 16 | -------------------------------------------------------------------------------- /article_95/05_sum.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | vector1 := narray.NewArray([]float64{1, 2, 3, 4, 5}, 5) 11 | 12 | sum := vector1.Sum() 13 | fmt.Println(sum) 14 | } 15 | -------------------------------------------------------------------------------- /article_95/06_prod.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | vector1 := narray.NewArray([]float64{1, 2, 3, 4, 5}, 5) 11 | 12 | prod := vector1.Prod() 13 | fmt.Println(prod) 14 | } 15 | -------------------------------------------------------------------------------- /article_95/07_add.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | vector1 := narray.NewArray([]float64{1, 2, 3, 4, 5}, 5) 11 | vector2 := narray.NewArray([]float64{1, 2, 3, 4, 5}, 5) 12 | 13 | vector3 := narray.Add(nil, vector1, vector2) 14 | fmt.Println(vector1) 15 | fmt.Println(vector2) 16 | fmt.Println(vector3) 17 | } 18 | -------------------------------------------------------------------------------- /article_95/09_dot.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | vector1 := narray.NewArray([]float64{1, 2, 3, 4, 5}, 5) 11 | 12 | dotProduct := narray.Dot(vector1, vector1) 13 | fmt.Println(dotProduct) 14 | fmt.Println(1*1 + 2*2 + 3*3 + 4*4 + 5*5) 15 | } 16 | -------------------------------------------------------------------------------- /article_95/10_dot.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | vector1 := narray.NewArray([]float64{1, 2, 3}, 3) 11 | vector2 := narray.NewArray([]float64{4, 5, 6}, 3) 12 | vector3 := narray.NewArray([]float64{7, 8, 9}, 3) 13 | 14 | dotProduct := narray.Dot(vector1, vector2, vector3) 15 | fmt.Println(dotProduct) 16 | } 17 | -------------------------------------------------------------------------------- /article_95/14_add_constant.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | vector1 := narray.NewArray([]float64{1, 2, 3, 4, 5}, 5) 11 | vector2 := narray.New(5) 12 | 13 | narray.AddConst(vector2, vector1, 100) 14 | fmt.Println(vector1) 15 | fmt.Println(vector2) 16 | } 17 | -------------------------------------------------------------------------------- /article_95/15_add_scaled.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | vector1 := narray.NewArray([]float64{1, 2, 3, 4, 5}, 5) 11 | vector2 := narray.NewArray([]float64{1, 2, 3, 4, 5}, 5) 12 | 13 | narray.AddScaled(vector1, vector2, 100) 14 | fmt.Println(vector1) 15 | fmt.Println(vector2) 16 | } 17 | -------------------------------------------------------------------------------- /article_95/16_to_matrix.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | matrix := narray.NewArray([]float64{1, 2, 3, 4, 5, 6}, 3, 2) 11 | 12 | trueMatrix := matrix.Matrix(-1, -1) 13 | fmt.Println(matrix) 14 | fmt.Println(trueMatrix) 15 | } 16 | -------------------------------------------------------------------------------- /article_95/20_matrix_dims.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | narray "github.com/akualab/narray/na64" 7 | ) 8 | 9 | func main() { 10 | matrix := narray.NewArray([]float64{1, 2, 3, 4, 5, 6}, 3, 2) 11 | 12 | trueMatrix := matrix.Matrix(-1, -1) 13 | fmt.Println(matrix) 14 | fmt.Println(trueMatrix) 15 | 16 | fmt.Println(trueMatrix.Dims()) 17 | } 18 | -------------------------------------------------------------------------------- /article_95/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_95/README.md -------------------------------------------------------------------------------- /article_95/cube.dat: -------------------------------------------------------------------------------- 1 | {"rank":3,"shape":[3,2,2],"data":[1,2,3,4,5,6,7,8,9,10,11,12],"strides":[4,2,1]} 2 | -------------------------------------------------------------------------------- /article_95/go.mod: -------------------------------------------------------------------------------- 1 | module narray-demos 2 | 3 | go 1.18 4 | 5 | require github.com/akualab/narray v0.0.0-20150719231847-f1469ca2dcda // indirect 6 | -------------------------------------------------------------------------------- /article_95/go.sum: -------------------------------------------------------------------------------- 1 | github.com/akualab/narray v0.0.0-20150719231847-f1469ca2dcda h1:nQDCnea62a0m8ftKitrMXZfKrj0jBTcewPjTQLF6ZFo= 2 | github.com/akualab/narray v0.0.0-20150719231847-f1469ca2dcda/go.mod h1:6YzkTn3pv9xhDO6WcNUd3bot0eMQ5Zc8/X+IaAfSJOU= 3 | -------------------------------------------------------------------------------- /article_95/matrix.dat: -------------------------------------------------------------------------------- 1 | {"rank":2,"shape":[3,2],"data":[1,2,3,4,5,6],"strides":[2,1]} 2 | -------------------------------------------------------------------------------- /article_95/vector.dat: -------------------------------------------------------------------------------- 1 | {"rank":1,"shape":[3],"data":[1,2,3],"strides":[1]} 2 | -------------------------------------------------------------------------------- /article_96/01_empty_deque.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | fmt.Println("Deque length: ", q.Len()) 13 | fmt.Println("Deque capacity:", q.Cap()) 14 | fmt.Println("Deque value: ", q) 15 | } 16 | -------------------------------------------------------------------------------- /article_96/02_pushback.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | for i := 1; i <= 10; i++ { 13 | q.PushBack(100 + i) 14 | fmt.Println("Deque length: ", q.Len()) 15 | fmt.Println("Deque capacity:", q.Cap()) 16 | fmt.Println("Deque value: ", q) 17 | fmt.Println() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /article_96/03_length_capacity.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | fmt.Println("Length Capacity") 13 | for i := 1; i <= 1000; i++ { 14 | q.PushBack(i) 15 | fmt.Printf("%5d %5d\n", q.Len(), q.Cap()) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /article_96/06_as_queue_1.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | for i := 1; i <= 10; i++ { 13 | q.PushBack(100 + i*2) 14 | q.PushBack(101 + i*2) 15 | fmt.Println(q.PopFront()) 16 | } 17 | 18 | for q.Len() > 0 { 19 | fmt.Println(q.PopFront()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /article_96/07_as_queue_2.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | for i := 1; i <= 10; i++ { 13 | q.PushFront(100 + i*2) 14 | q.PushFront(101 + i*2) 15 | fmt.Println(q.PopBack()) 16 | } 17 | 18 | for q.Len() > 0 { 19 | fmt.Println(q.PopBack()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /article_96/08_as_stack_1.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | for i := 1; i <= 10; i++ { 13 | q.PushFront(100 + i) 14 | } 15 | 16 | for q.Len() > 0 { 17 | fmt.Println(q.PopFront()) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /article_96/09_as_stack_2.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | for i := 1; i <= 10; i++ { 13 | q.PushBack(100 + i) 14 | } 15 | 16 | for q.Len() > 0 { 17 | fmt.Println(q.PopBack()) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /article_96/11_rotate.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | for i := 1; i <= 10; i++ { 13 | q.PushBack(100 + i) 14 | } 15 | 16 | q.Rotate(3) 17 | 18 | for q.Len() > 0 { 19 | fmt.Println(q.PopFront()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /article_96/12_rotate.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gammazero/deque" 7 | ) 8 | 9 | func main() { 10 | var q deque.Deque[int] 11 | 12 | for i := 1; i <= 10; i++ { 13 | q.PushBack(100 + i) 14 | } 15 | 16 | q.Rotate(-3) 17 | 18 | for q.Len() > 0 { 19 | fmt.Println(q.PopFront()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /article_96/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_96/README.md -------------------------------------------------------------------------------- /article_96/benchmarks/go.mod: -------------------------------------------------------------------------------- 1 | module deque-demos 2 | 3 | go 1.18 4 | 5 | require github.com/gammazero/deque v0.2.1 // indirect 6 | -------------------------------------------------------------------------------- /article_96/benchmarks/go.sum: -------------------------------------------------------------------------------- 1 | github.com/gammazero/deque v0.2.1 h1:qSdsbG6pgp6nL7A0+K/B7s12mcCY/5l5SIUpMOl+dC0= 2 | github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU= 3 | -------------------------------------------------------------------------------- /article_96/go.mod: -------------------------------------------------------------------------------- 1 | module deque-demos 2 | 3 | go 1.18 4 | 5 | require github.com/gammazero/deque v0.2.1 // indirect 6 | -------------------------------------------------------------------------------- /article_96/go.sum: -------------------------------------------------------------------------------- 1 | github.com/gammazero/deque v0.2.1 h1:qSdsbG6pgp6nL7A0+K/B7s12mcCY/5l5SIUpMOl+dC0= 2 | github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU= 3 | -------------------------------------------------------------------------------- /article_97/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_97/README.md -------------------------------------------------------------------------------- /article_97/go.mod: -------------------------------------------------------------------------------- 1 | module fx 2 | 3 | go 1.18 4 | 5 | require github.com/Konstantin8105/c4go v0.0.0-20211115111653-1c67b1543446 6 | 7 | require ( 8 | github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 // indirect 9 | golang.org/x/sys v0.1.0 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /article_97/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | puts("Hello world"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /article_97/strings1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) { 6 | char *s = (char*)malloc(100*sizeof(char)); 7 | 8 | strcpy(s, "Hello "); 9 | strcat(s, "world!"); 10 | puts(s); 11 | 12 | free(s); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /article_97/strings2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) { 6 | char *s = (char*)malloc(100*sizeof(char)); 7 | 8 | strcpy(s, "Hello*"); 9 | strcat(s, "world!"); 10 | puts(s); 11 | 12 | s[5] = ' '; 13 | puts(s); 14 | 15 | free(s); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /article_98/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_98/README.md -------------------------------------------------------------------------------- /article_98/config_to_asm.go: -------------------------------------------------------------------------------- 1 | func main() { 2 | configuration := ConfigStruct{} 3 | GetStorageConfigurationByValue(configuration) 4 | GetStorageConfigurationByReference(&configuration) 5 | configuration.GetStorageConfigurationByValue() 6 | configuration.GetStorageConfigurationByReference() 7 | } 8 | -------------------------------------------------------------------------------- /article_98/map_or_slice/go.mod: -------------------------------------------------------------------------------- 1 | module slice-or-map 2 | 3 | go 1.18 4 | 5 | require github.com/google/uuid v1.3.0 // indirect 6 | -------------------------------------------------------------------------------- /article_98/map_or_slice/go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= 2 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 3 | -------------------------------------------------------------------------------- /article_98/maps/go.mod: -------------------------------------------------------------------------------- 1 | module map-bench 2 | 3 | go 1.18 4 | 5 | require github.com/google/uuid v1.3.0 // indirect 6 | -------------------------------------------------------------------------------- /article_98/maps/go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= 2 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 3 | -------------------------------------------------------------------------------- /article_98/parameter_value_reference/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "config-struct/conf" 5 | "fmt" 6 | ) 7 | 8 | const ( 9 | configFileEnvVariableName = "CONFIG_FILE" 10 | defaultConfigFileName = "config" 11 | ) 12 | 13 | func main() { 14 | cfg, err := conf.LoadConfiguration("", "") 15 | if err != nil { 16 | panic(err) 17 | 18 | } 19 | fmt.Println(cfg) 20 | } 21 | -------------------------------------------------------------------------------- /article_98/sets/go.mod: -------------------------------------------------------------------------------- 1 | module sets-slice-or-map 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /article_99/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_99/README.md -------------------------------------------------------------------------------- /article_99/mutex_channel/go.mod: -------------------------------------------------------------------------------- 1 | module mutex-channel 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /article_99/parameters_benchmark_1/go.mod: -------------------------------------------------------------------------------- 1 | module parameters-benchmark 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /article_99/parameters_benchmark_2/go.mod: -------------------------------------------------------------------------------- 1 | module parameters-benchmark 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /article_99/pass_by_value_1.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func changeMe(slice []int) { 6 | slice[0] = 42 7 | } 8 | 9 | func main() { 10 | s := []int{1, 2, 3} 11 | fmt.Println(s) 12 | changeMe(s) 13 | fmt.Println(s) 14 | } 15 | -------------------------------------------------------------------------------- /article_99/range-val-copy-1/go.mod: -------------------------------------------------------------------------------- 1 | module range-val-copy-1 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /article_99/range-val-copy-2/go.mod: -------------------------------------------------------------------------------- 1 | module range-val-copy-1 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /article_99/range-val-copy-2/out.txt: -------------------------------------------------------------------------------- 1 | $ go test -bench=. -benchtime=100000x -cpuprofile profile.out 2 | goos: linux 3 | goarch: amd64 4 | pkg: range-val-copy-1 5 | cpu: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 6 | BenchmarkCountValues1-8 100000 144225 ns/op 7 | BenchmarkCountValues2-8 100000 12300 ns/op 8 | PASS 9 | ok range-val-copy-1 15.853s 10 | -------------------------------------------------------------------------------- /article_A0/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A0/README.md -------------------------------------------------------------------------------- /article_A0/glow-test-0/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-1 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require github.com/psilva261/timsort v1.0.0 // indirect 8 | -------------------------------------------------------------------------------- /article_A0/glow-test-0/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | 7 | "github.com/chrislusf/glow/flow" 8 | ) 9 | 10 | func main() { 11 | flag.Parse() 12 | 13 | flow.New() 14 | } 15 | -------------------------------------------------------------------------------- /article_A0/glow-test-1/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-1 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require github.com/psilva261/timsort v1.0.0 // indirect 8 | -------------------------------------------------------------------------------- /article_A0/glow-test-2/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-2 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require github.com/psilva261/timsort v1.0.0 // indirect 8 | -------------------------------------------------------------------------------- /article_A0/glow-test-2/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | 6 | "github.com/chrislusf/glow/flow" 7 | ) 8 | 9 | func main() { 10 | flag.Parse() 11 | 12 | flow. 13 | New(). 14 | Slice([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}). 15 | Reduce(func(x int, y int) int { 16 | return x + y 17 | }). 18 | Map(func(x int) { 19 | println("sum:", x) 20 | }). 21 | Run() 22 | } 23 | -------------------------------------------------------------------------------- /article_A0/glow-test-3/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-3 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require github.com/psilva261/timsort v1.0.0 // indirect 8 | -------------------------------------------------------------------------------- /article_A0/glow-test-4/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-4 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require github.com/psilva261/timsort v1.0.0 // indirect 8 | -------------------------------------------------------------------------------- /article_A0/glow-test-5/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-5 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require ( 8 | github.com/golang/protobuf v1.5.2 // indirect 9 | github.com/psilva261/timsort v1.0.0 // indirect 10 | google.golang.org/protobuf v1.33.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /article_A0/glow-test-6/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-6 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require ( 8 | github.com/golang/protobuf v1.5.2 // indirect 9 | github.com/psilva261/timsort v1.0.0 // indirect 10 | google.golang.org/protobuf v1.33.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /article_A0/glow-test-7/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-7 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require ( 8 | github.com/golang/protobuf v1.5.2 // indirect 9 | github.com/psilva261/timsort v1.0.0 // indirect 10 | google.golang.org/protobuf v1.33.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /article_A0/glow-test-8/data.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 10 3 | 100 4 | 1000 5 | 10000 6 | 100000 7 | 1000000 8 | 10000000 9 | -------------------------------------------------------------------------------- /article_A0/glow-test-8/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-8 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require ( 8 | github.com/golang/protobuf v1.5.2 // indirect 9 | github.com/psilva261/timsort v1.0.0 // indirect 10 | google.golang.org/protobuf v1.33.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /article_A0/glow-test-9/data.txt: -------------------------------------------------------------------------------- 1 | 1983 Ken Thompson 2 | 1983 Dennis Ritchie 3 | 1988 Ivan Sutherland 4 | 1979 Kenneth Iverson 5 | 1989 William Kahan 6 | 1977 John Backus 7 | -------------------------------------------------------------------------------- /article_A0/glow-test-9/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-9 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require ( 8 | github.com/golang/protobuf v1.5.2 // indirect 9 | github.com/psilva261/timsort v1.0.0 // indirect 10 | google.golang.org/protobuf v1.33.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /article_A0/glow-test-9/plot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A0/glow-test-9/plot.png -------------------------------------------------------------------------------- /article_A0/glow-test-A/data.txt: -------------------------------------------------------------------------------- 1 | 1983 Ken Thompson 2 | 1983 Dennis Ritchie 3 | 1988 Ivan Sutherland 4 | 1979 Kenneth Iverson 5 | 1989 William Kahan 6 | 1977 John Backus 7 | -------------------------------------------------------------------------------- /article_A0/glow-test-A/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-A 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require ( 8 | github.com/golang/protobuf v1.5.2 // indirect 9 | github.com/psilva261/timsort v1.0.0 // indirect 10 | google.golang.org/protobuf v1.33.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /article_A0/glow-test-A/plot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A0/glow-test-A/plot.png -------------------------------------------------------------------------------- /article_A0/glow-test-B/data.txt: -------------------------------------------------------------------------------- 1 | 1983 Ken Thompson 2 | 1983 Dennis Ritchie 3 | 1988 Ivan Sutherland 4 | 1979 Kenneth Iverson 5 | 1989 William Kahan 6 | 1977 John Backus 7 | -------------------------------------------------------------------------------- /article_A0/glow-test-B/go.mod: -------------------------------------------------------------------------------- 1 | module glow-test-B 2 | 3 | go 1.18 4 | 5 | require github.com/chrislusf/glow v0.0.0-20181102060906-4c40a2717eee 6 | 7 | require ( 8 | github.com/golang/protobuf v1.5.2 // indirect 9 | github.com/psilva261/timsort v1.0.0 // indirect 10 | google.golang.org/protobuf v1.33.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /article_A0/glow-test-B/plot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A0/glow-test-B/plot.png -------------------------------------------------------------------------------- /article_A1/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A1/README.md -------------------------------------------------------------------------------- /article_A1/string-builders-2/concatenation.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func BuildStringUsingConcatenation(n int) string { 4 | // budeme pouzivat primo retezec 5 | s := "" 6 | 7 | // postupne pridavani prvku do vysledneho retezce 8 | for i := 0; i < n; i++ { 9 | s += "foo " 10 | } 11 | 12 | // vysledny retezec 13 | return s 14 | } 15 | -------------------------------------------------------------------------------- /article_A1/string-builders-2/go.mod: -------------------------------------------------------------------------------- 1 | module string-builders-2 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /article_A1/string-builders-2/run_benchmark.sh: -------------------------------------------------------------------------------- 1 | go test -bench=. -timeout 160m -benchtime=1x 2 | go test -bench=. -timeout 160m -benchtime=10x 3 | go test -bench=. -timeout 160m -benchtime=100x 4 | go test -bench=. -timeout 160m -benchtime=1000x 5 | go test -bench=. -timeout 160m -benchtime=10000x 6 | go test -bench=. -timeout 160m -benchtime=100000x 7 | go test -bench=. -timeout 160m -benchtime=1000000x 8 | 9 | -------------------------------------------------------------------------------- /article_A1/string-builders-2/string_buffer.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "bytes" 4 | 5 | func BuildStringUsingStringBuffer(n int) string { 6 | // budeme pouzivat buffer 7 | var bb bytes.Buffer 8 | 9 | // postupne pridavani prvku do vysledneho retezce 10 | for i := 0; i < n; i++ { 11 | bb.WriteString("foo ") 12 | } 13 | 14 | // prevod objektu na retezec 15 | return bb.String() 16 | } 17 | -------------------------------------------------------------------------------- /article_A1/string-builders-2/string_builder.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "strings" 4 | 5 | func BuildStringUsingStringBuilder(n int) string { 6 | // budeme pouzivat String Builder 7 | var sb strings.Builder 8 | 9 | // postupne pridavani prvku do vysledneho retezce 10 | for i := 0; i < n; i++ { 11 | sb.WriteString("foo ") 12 | } 13 | 14 | // prevod objektu na retezec 15 | return sb.String() 16 | } 17 | -------------------------------------------------------------------------------- /article_A1/string-builders/concatenation.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func BuildStringUsingConcatenation(n int) string { 4 | // budeme pouzivat primo retezec 5 | s := "" 6 | 7 | // postupne pridavani prvku do vysledneho retezce 8 | for i := 0; i < n; i++ { 9 | s += "*" 10 | } 11 | 12 | // vysledny retezec 13 | return s 14 | } 15 | -------------------------------------------------------------------------------- /article_A1/string-builders/go.mod: -------------------------------------------------------------------------------- 1 | module string-builders 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /article_A1/string-builders/run_benchmark.sh: -------------------------------------------------------------------------------- 1 | go test -bench=. -benchtime=1x 2 | go test -bench=. -benchtime=10x 3 | go test -bench=. -benchtime=100x 4 | go test -bench=. -benchtime=1000x 5 | go test -bench=. -benchtime=10000x 6 | go test -bench=. -benchtime=100000x 7 | go test -bench=. -benchtime=1000000x 8 | -------------------------------------------------------------------------------- /article_A1/string-builders/string_buffer.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "bytes" 4 | 5 | func BuildStringUsingStringBuffer(n int) string { 6 | // budeme pouzivat buffer 7 | var bb bytes.Buffer 8 | 9 | // postupne pridavani prvku do vysledneho retezce 10 | for i := 0; i < n; i++ { 11 | bb.WriteRune('*') 12 | } 13 | 14 | // prevod objektu na retezec 15 | return bb.String() 16 | } 17 | -------------------------------------------------------------------------------- /article_A1/string-builders/string_builder.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "strings" 4 | 5 | func BuildStringUsingStringBuilder(n int) string { 6 | // budeme pouzivat String Builder 7 | var sb strings.Builder 8 | 9 | // postupne pridavani prvku do vysledneho retezce 10 | for i := 0; i < n; i++ { 11 | sb.WriteRune('*') 12 | } 13 | 14 | // prevod objektu na retezec 15 | return sb.String() 16 | } 17 | -------------------------------------------------------------------------------- /article_A2/command/20230708113941_users.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | -- +goose StatementBegin 3 | CREATE TABLE users ( 4 | id INTEGER NOT NULL, 5 | name VARCHAR NOT NULL, 6 | surname VARCHAR NOT NULL, 7 | PRIMARY KEY (id) 8 | ); 9 | -- +goose StatementEnd 10 | 11 | -- +goose Down 12 | -- +goose StatementBegin 13 | DROP TABLE users; 14 | -- +goose StatementEnd 15 | -------------------------------------------------------------------------------- /article_A2/command/20230708115539_role_column.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | -- +goose StatementBegin 3 | ALTER TABLE users ADD COLUMN role VARCHAR; 4 | -- +goose StatementEnd 5 | 6 | -- +goose Down 7 | -- +goose StatementBegin 8 | ALTER TABLE users DROP COLUMN role; 9 | -- +goose StatementEnd 10 | -------------------------------------------------------------------------------- /article_A2/status/20230708113941_users.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | -- +goose StatementBegin 3 | CREATE TABLE users ( 4 | id INTEGER NOT NULL, 5 | name VARCHAR NOT NULL, 6 | surname VARCHAR NOT NULL, 7 | PRIMARY KEY (id) 8 | ); 9 | -- +goose StatementEnd 10 | 11 | -- +goose Down 12 | -- +goose StatementBegin 13 | DROP TABLE users; 14 | -- +goose StatementEnd 15 | -------------------------------------------------------------------------------- /article_A2/status/20230708115539_role_column.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | -- +goose StatementBegin 3 | ALTER TABLE users ADD COLUMN role VARCHAR; 4 | -- +goose StatementEnd 5 | 6 | -- +goose Down 7 | -- +goose StatementBegin 8 | ALTER TABLE users DROP COLUMN role; 9 | -- +goose StatementEnd 10 | -------------------------------------------------------------------------------- /article_A2/up/20230708113941_users.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | -- +goose StatementBegin 3 | CREATE TABLE users ( 4 | id INTEGER NOT NULL, 5 | name VARCHAR NOT NULL, 6 | surname VARCHAR NOT NULL, 7 | PRIMARY KEY (id) 8 | ); 9 | -- +goose StatementEnd 10 | 11 | -- +goose Down 12 | -- +goose StatementBegin 13 | DROP TABLE users; 14 | -- +goose StatementEnd 15 | -------------------------------------------------------------------------------- /article_A2/up/20230708115539_role_column.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | -- +goose StatementBegin 3 | ALTER TABLE users ADD COLUMN role VARCHAR; 4 | -- +goose StatementEnd 5 | 6 | -- +goose Down 7 | -- +goose StatementBegin 8 | ALTER TABLE users DROP COLUMN role; 9 | -- +goose StatementEnd 10 | -------------------------------------------------------------------------------- /article_A2/up/test.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A2/up/test.db -------------------------------------------------------------------------------- /article_A5/httpServer/go.mod: -------------------------------------------------------------------------------- 1 | module x 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A6/read-npy1/go.mod: -------------------------------------------------------------------------------- 1 | module read-npy1 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/sbinet/npyio v0.7.0 // indirect 7 | gonum.org/v1/gonum v0.9.3 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_A6/read-npy1/int8_vector.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/read-npy1/int8_vector.npy -------------------------------------------------------------------------------- /article_A6/read-npy2/go.mod: -------------------------------------------------------------------------------- 1 | module read-npy2 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/sbinet/npyio v0.7.0 // indirect 7 | gonum.org/v1/gonum v0.9.3 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_A6/read-npy2/int_vector.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/read-npy2/int_vector.npy -------------------------------------------------------------------------------- /article_A6/read-npy3/go.mod: -------------------------------------------------------------------------------- 1 | module read-npy3 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/sbinet/npyio v0.7.0 // indirect 7 | gonum.org/v1/gonum v0.9.3 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_A6/read-npy3/int_vector.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/read-npy3/int_vector.npy -------------------------------------------------------------------------------- /article_A6/read-npy4/float_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/read-npy4/float_matrix.npy -------------------------------------------------------------------------------- /article_A6/read-npy4/go.mod: -------------------------------------------------------------------------------- 1 | module read-npy4 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/sbinet/npyio v0.7.0 // indirect 7 | gonum.org/v1/gonum v0.9.3 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_A6/read-npy5/float_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/read-npy5/float_matrix.npy -------------------------------------------------------------------------------- /article_A6/read-npy5/go.mod: -------------------------------------------------------------------------------- 1 | module read-npy5 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/sbinet/npyio v0.7.0 // indirect 7 | gonum.org/v1/gonum v0.9.3 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_A6/read-npy6/float_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/read-npy6/float_matrix.npy -------------------------------------------------------------------------------- /article_A6/read-npy6/go.mod: -------------------------------------------------------------------------------- 1 | module read-npy6 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/sbinet/npyio v0.7.0 // indirect 7 | gonum.org/v1/gonum v0.9.3 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_A6/read-npy7/float_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/read-npy7/float_matrix.npy -------------------------------------------------------------------------------- /article_A6/read-npy7/go.mod: -------------------------------------------------------------------------------- 1 | module read-npy7 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/sbinet/npyio v0.7.0 // indirect 7 | gonum.org/v1/gonum v0.9.3 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_A6/read-npy8/go.mod: -------------------------------------------------------------------------------- 1 | module read-npy7 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/sbinet/npyio v0.7.0 // indirect 7 | gonum.org/v1/gonum v0.9.3 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /article_A6/write-npy1/go.mod: -------------------------------------------------------------------------------- 1 | module write-npy1 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/campoy/embedmd v1.0.0 // indirect 7 | github.com/pmezard/go-difflib v1.0.0 // indirect 8 | github.com/sbinet/npyio v0.7.0 // indirect 9 | gonum.org/v1/gonum v0.9.3 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /article_A6/write-npy1/int8_vector.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/write-npy1/int8_vector.npy -------------------------------------------------------------------------------- /article_A6/write-npy2/go.mod: -------------------------------------------------------------------------------- 1 | module write-npy2 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/campoy/embedmd v1.0.0 // indirect 7 | github.com/pmezard/go-difflib v1.0.0 // indirect 8 | github.com/sbinet/npyio v0.7.0 // indirect 9 | gonum.org/v1/gonum v0.9.3 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /article_A6/write-npy2/int_vector.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/write-npy2/int_vector.npy -------------------------------------------------------------------------------- /article_A6/write-npy3/float_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_A6/write-npy3/float_matrix.npy -------------------------------------------------------------------------------- /article_A6/write-npy3/go.mod: -------------------------------------------------------------------------------- 1 | module write-npy3 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/campoy/embedmd v1.0.0 // indirect 7 | github.com/pmezard/go-difflib v1.0.0 // indirect 8 | github.com/sbinet/npyio v0.7.0 // indirect 9 | gonum.org/v1/gonum v0.9.3 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /article_A6/write-npy4/go.mod: -------------------------------------------------------------------------------- 1 | module write-npy4 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/campoy/embedmd v1.0.0 // indirect 7 | github.com/pmezard/go-difflib v1.0.0 // indirect 8 | github.com/sbinet/npyio v0.7.0 // indirect 9 | gonum.org/v1/gonum v0.9.3 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /article_A7/haproxy_controller/go.mod: -------------------------------------------------------------------------------- 1 | module haproxy_controller 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A7/multi_connection_tcp_server/go.mod: -------------------------------------------------------------------------------- 1 | module slow_tcp_server 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A7/multi_connection_unix_socket_server/go.mod: -------------------------------------------------------------------------------- 1 | module multi_connection_unix_socket_server 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A7/simple_tcp_client/go.mod: -------------------------------------------------------------------------------- 1 | module simple_tcp_client 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A7/simple_tcp_server/go.mod: -------------------------------------------------------------------------------- 1 | module simple_tcp_server 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A7/simple_unix_socket_client/go.mod: -------------------------------------------------------------------------------- 1 | module simple_unix_socket_client 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A7/simple_unix_socket_server/go.mod: -------------------------------------------------------------------------------- 1 | module simple_tcp_server 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A7/slow_tcp_server/go.mod: -------------------------------------------------------------------------------- 1 | module slow_tcp_server 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /article_A8/01_bigint_construction.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Int 10 | var y big.Int 11 | x.SetInt64(1) 12 | y.SetInt64(2) 13 | 14 | fmt.Println(x.Text(10)) 15 | fmt.Println(y.Text(10)) 16 | } 17 | -------------------------------------------------------------------------------- /article_A8/02_bigint_add.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Int 10 | var y big.Int 11 | x.SetInt64(1) 12 | y.SetInt64(2) 13 | 14 | var z big.Int 15 | z.Add(&x, &y) 16 | 17 | fmt.Println(x.Text(10)) 18 | fmt.Println(y.Text(10)) 19 | fmt.Println(z.Text(10)) 20 | } 21 | -------------------------------------------------------------------------------- /article_A8/03_bigint_large_numbers.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Int 10 | x.SetInt64(2) 11 | 12 | var z big.Int 13 | z.SetInt64(1) 14 | 15 | for i := 0; i < 100; i++ { 16 | z.Mul(&z, &x) 17 | fmt.Println(z.Text(10)) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /article_A8/05_bigint_print_base.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Int 10 | x.SetInt64(10000000000) 11 | 12 | for base := 2; base <= 62; base++ { 13 | fmt.Println(base, x.Text(base)) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /article_A8/10_rationals_construction_B.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewRat(1, 2) 10 | y := big.NewRat(1, 3) 11 | z := big.NewRat(2, 1) 12 | w := big.NewRat(4, 2) 13 | 14 | fmt.Println(x.String()) 15 | fmt.Println(y.String()) 16 | fmt.Println(z.String()) 17 | fmt.Println(w.String()) 18 | } 19 | -------------------------------------------------------------------------------- /article_A8/11_rationals_add.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Rat 10 | var y big.Rat 11 | var z big.Rat 12 | 13 | x.SetFrac64(1, 2) 14 | y.SetFrac64(1, 3) 15 | z.Add(&x, &y) 16 | 17 | fmt.Println(x.String()) 18 | fmt.Println(y.String()) 19 | fmt.Println(z.String()) 20 | } 21 | -------------------------------------------------------------------------------- /article_A8/12_rationals_mul.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Rat 10 | var y big.Rat 11 | var z big.Rat 12 | 13 | x.SetFrac64(1, 2) 14 | y.SetFrac64(1, 1) 15 | z.SetFrac64(1, 1) 16 | 17 | for i := 0; i < 10; i++ { 18 | z.Mul(&z, &x) 19 | z.Add(&z, &y) 20 | 21 | fmt.Println(z.String()) 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /article_A8/14_rationals_to_float.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Rat 10 | var y big.Rat 11 | var z big.Rat 12 | 13 | x.SetFrac64(1, 2) 14 | y.SetFrac64(1, 1) 15 | z.SetFrac64(1, 1) 16 | 17 | for i := 0; i < 10; i++ { 18 | z.Mul(&z, &x) 19 | z.Add(&z, &y) 20 | 21 | fmt.Println(z.Float64()) 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /article_A8/18_rationals_div_zero.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Rat 10 | 11 | x.SetFrac64(1, 0) 12 | 13 | fmt.Println(x.String()) 14 | } 15 | -------------------------------------------------------------------------------- /article_A8/19_rationals_div_zero.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Rat 10 | 11 | x.SetFrac64(0, 1) 12 | 13 | fmt.Println(x.String()) 14 | 15 | x.Inv(&x) 16 | fmt.Println(x.String()) 17 | } 18 | -------------------------------------------------------------------------------- /article_A9/01_bigfloat_construction.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(1.0) 10 | y := big.NewFloat(0.5) 11 | 12 | for i := 1; i < 82; i++ { 13 | fmt.Println(x.Text('f', 80)) 14 | x.Mul(x, y) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /article_A9/02_bigfloat_add.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(1) 10 | y := big.NewFloat(0.1) 11 | 12 | for i := 0; i < 20; i++ { 13 | x.Add(x, y) 14 | fmt.Println(x.Text('f', 10)) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /article_A9/03_bigfloat_large_numbers.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(1) 10 | y := big.NewFloat(99) 11 | 12 | for i := 0; i < 40; i++ { 13 | x.Mul(x, y) 14 | fmt.Println(x.Text('f', 0)) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /article_A9/04_bigfloat_small_numbers.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(1) 10 | y := big.NewFloat(1 / 99.0) 11 | 12 | for i := 0; i < 30; i++ { 13 | x.Mul(x, y) 14 | fmt.Println(x.Text('f', 50)) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /article_A9/05_bigfloat_exp_format.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(1) 10 | y := big.NewFloat(99) 11 | 12 | for i := 0; i < 60; i++ { 13 | x.Mul(x, y) 14 | fmt.Println(x.Text('e', 10)) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /article_A9/06_bigfloat_exp_format.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(1) 10 | y := big.NewFloat(1 / 99.0) 11 | 12 | for i := 0; i < 30; i++ { 13 | x.Mul(x, y) 14 | fmt.Println(x.Text('e', 50)) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /article_A9/07_hexa_mantissa.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(1) 10 | y := big.NewFloat(1 / 99.0) 11 | 12 | for i := 0; i < 30; i++ { 13 | x.Mul(x, y) 14 | fmt.Println(x.Text('x', 50)) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /article_A9/09_bigfloat_to_rat.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(2.0) 10 | y := big.NewFloat(0.1) 11 | 12 | for i := 0; i < 10; i++ { 13 | var ratio big.Rat 14 | _, accuracy := x.Rat(&ratio) 15 | fmt.Println(accuracy, ratio.String()) 16 | 17 | x.Mul(x, y) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /article_A9/10_bigfloat_to_float64.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(2.0) 10 | y := big.NewFloat(0.1) 11 | 12 | for i := 0; i < 20; i++ { 13 | value, accuracy := x.Float64() 14 | fmt.Println(accuracy, value) 15 | 16 | x.Mul(x, y) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /article_A9/11_bigfloat_to_float32.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(2.0) 10 | y := big.NewFloat(0.1) 11 | 12 | for i := 0; i < 20; i++ { 13 | value, accuracy := x.Float32() 14 | fmt.Println(accuracy, value) 15 | 16 | x.Mul(x, y) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /article_A9/14_positive_infinity.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(1.0) 10 | y := big.NewFloat(0.0) 11 | 12 | var result big.Float 13 | result.Quo(x, y) 14 | 15 | fmt.Println(result.Text('f', 31)) 16 | 17 | fmt.Println() 18 | 19 | fmt.Println(x.IsInf()) 20 | fmt.Println(y.IsInf()) 21 | fmt.Println(result.IsInf()) 22 | } 23 | -------------------------------------------------------------------------------- /article_A9/15_negative_infinity.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(-1.0) 10 | y := big.NewFloat(0.0) 11 | 12 | var result big.Float 13 | result.Quo(x, y) 14 | 15 | fmt.Println(result.Text('f', 31)) 16 | 17 | fmt.Println() 18 | 19 | fmt.Println(x.IsInf()) 20 | fmt.Println(y.IsInf()) 21 | fmt.Println(result.IsInf()) 22 | } 23 | -------------------------------------------------------------------------------- /article_A9/20_div_by_zero.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | x := big.NewFloat(0.0) 10 | 11 | var divideZeroByZero big.Float 12 | divideZeroByZero.Quo(x, x) 13 | fmt.Println(x.Text('f', 31)) 14 | } 15 | -------------------------------------------------------------------------------- /article_AA/01_zero_value/go.mod: -------------------------------------------------------------------------------- 1 | module decimal-1 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/01_zero_value/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/01_zero_value/zero_value.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/shopspring/decimal" 7 | ) 8 | 9 | func main() { 10 | var d decimal.Decimal 11 | fmt.Println(d) 12 | } 13 | -------------------------------------------------------------------------------- /article_AA/02_construct_from_int_32/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-int-32 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/02_construct_from_int_32/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/03_construct_from_int/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-int 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/03_construct_from_int/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/04_construct_from_float_32/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-float-32 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/04_construct_from_float_32/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/05_construct_from_float/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-float 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/05_construct_from_float/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/06_construct_from_float_with_exponent/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-float-with-exponent 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/06_construct_from_float_with_exponent/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/07_construct_from_string/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-string 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/07_construct_from_string/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/08_construct_from_formatted_string/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-formatted-string 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/08_construct_from_formatted_string/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/09_construct_from_formatted_string/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-formatted-string 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/09_construct_from_formatted_string/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/10_construct_from_formatted_string/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-formatted-string 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/10_construct_from_formatted_string/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/11_construct_from_string_err/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-string 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/11_construct_from_string_err/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/12_require_from_string/go.mod: -------------------------------------------------------------------------------- 1 | module construct-from-string 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/12_require_from_string/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/13_arithmetic/go.mod: -------------------------------------------------------------------------------- 1 | module arithmetic 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/13_arithmetic/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/14_div_round/div_round.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/shopspring/decimal" 7 | ) 8 | 9 | func main() { 10 | x := decimal.NewFromInt32(1) 11 | 12 | y := decimal.NewFromInt32(7) 13 | 14 | for precision := 30; precision > 0; precision-- { 15 | r := x.DivRound(y, int32(precision)) 16 | fmt.Println(r) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /article_AA/14_div_round/go.mod: -------------------------------------------------------------------------------- 1 | module div-round 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/14_div_round/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/15_factorial/go.mod: -------------------------------------------------------------------------------- 1 | module div-round 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/15_factorial/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/16_aggregation/go.mod: -------------------------------------------------------------------------------- 1 | module aggregation 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/16_aggregation/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/17_internals/go.mod: -------------------------------------------------------------------------------- 1 | module internals 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/17_internals/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/18_pi_wallis_product/go.mod: -------------------------------------------------------------------------------- 1 | module pi-wallis-product 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/18_pi_wallis_product/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/19_benchmark/go.mod: -------------------------------------------------------------------------------- 1 | module div-round 2 | 3 | go 1.20 4 | 5 | require github.com/shopspring/decimal v1.3.1 // indirect 6 | -------------------------------------------------------------------------------- /article_AA/19_benchmark/go.sum: -------------------------------------------------------------------------------- 1 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 2 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 3 | -------------------------------------------------------------------------------- /article_AA/19_benchmark/run_benchmark.sh: -------------------------------------------------------------------------------- 1 | go test -bench=. -benchtime=1000x 2 | -------------------------------------------------------------------------------- /article_AA/big_zero_values.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | ) 7 | 8 | func main() { 9 | var x big.Int 10 | var y big.Rat 11 | var z big.Float 12 | 13 | fmt.Println("big.Int ", x.Text(10)) 14 | fmt.Println("big.Rat ", y.String()) 15 | fmt.Println("big.Float", z.Text('f', 10)) 16 | } 17 | -------------------------------------------------------------------------------- /article_AB/a/A1.txt: -------------------------------------------------------------------------------- 1 | A1 2 | -------------------------------------------------------------------------------- /article_AB/a/A2.txt: -------------------------------------------------------------------------------- 1 | A2 2 | -------------------------------------------------------------------------------- /article_AB/access_string.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "embed" 5 | "fmt" 6 | "log" 7 | ) 8 | 9 | //go:embed lorem_ipsum.txt 10 | var f embed.FS 11 | 12 | func main() { 13 | data, err := f.ReadFile("lorem_ipsum.txt") 14 | if err != nil { 15 | log.Fatal(err) 16 | } 17 | 18 | // pouziti retezce 19 | fmt.Println(string(data)) 20 | } 21 | -------------------------------------------------------------------------------- /article_AB/b/B1.txt: -------------------------------------------------------------------------------- 1 | B1 2 | -------------------------------------------------------------------------------- /article_AB/b/B2.txt: -------------------------------------------------------------------------------- 1 | B2 2 | -------------------------------------------------------------------------------- /article_AB/b/B3.txt: -------------------------------------------------------------------------------- 1 | B3 2 | -------------------------------------------------------------------------------- /article_AB/dir.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "embed" 5 | "fmt" 6 | "log" 7 | ) 8 | 9 | //go:embed *.txt 10 | var f embed.FS 11 | 12 | func main() { 13 | entries, err := f.ReadDir(".") 14 | if err != nil { 15 | log.Fatal(err) 16 | } 17 | 18 | for _, entry := range entries { 19 | fmt.Printf("%-25s %s\n", entry.Name(), entry.Type()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /article_AB/dir2.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "embed" 5 | "fmt" 6 | "log" 7 | ) 8 | 9 | //go:embed a/* 10 | //go:embed b/* 11 | var f embed.FS 12 | 13 | func main() { 14 | entries, err := f.ReadDir(".") 15 | if err != nil { 16 | log.Fatal(err) 17 | } 18 | 19 | for _, entry := range entries { 20 | fmt.Printf("%-25s %s\n", entry.Name(), entry.Type()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /article_AB/embed_binary1.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | _ "embed" 5 | "fmt" 6 | ) 7 | 8 | //go:embed lorem_ipsum.txt 9 | var loremIpsum []byte 10 | 11 | func main() { 12 | // pouziti retezce 13 | fmt.Println(loremIpsum) 14 | } 15 | -------------------------------------------------------------------------------- /article_AB/embed_binary2.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | _ "embed" 5 | "fmt" 6 | ) 7 | 8 | //go:embed lorem_ipsum.txt 9 | var loremIpsum []byte 10 | 11 | func main() { 12 | // pouziti retezce 13 | fmt.Println(string(loremIpsum)) 14 | } 15 | -------------------------------------------------------------------------------- /article_AB/embed_other_data.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | _ "embed" 5 | "fmt" 6 | ) 7 | 8 | type Foo struct { 9 | x string 10 | y bool 11 | } 12 | 13 | //go:embed lorem_ipsum.txt 14 | var loremIpsum Foo 15 | 16 | func main() { 17 | // pouziti struktury 18 | fmt.Println(loremIpsum) 19 | } 20 | -------------------------------------------------------------------------------- /article_AB/embed_string0.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | //go:embed hello.txt 8 | var helloMessage string 9 | 10 | func main() { 11 | // pouziti retezce 12 | fmt.Println(helloMessage) 13 | } 14 | -------------------------------------------------------------------------------- /article_AB/embed_string1.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "embed" 5 | "fmt" 6 | ) 7 | 8 | //go:embed hello.txt 9 | var helloMessage string 10 | 11 | func main() { 12 | // pouziti retezce 13 | fmt.Println(helloMessage) 14 | } 15 | -------------------------------------------------------------------------------- /article_AB/embed_string2.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | _ "embed" 5 | "fmt" 6 | ) 7 | 8 | //go:embed hello.txt 9 | var helloMessage string 10 | 11 | func main() { 12 | // pouziti retezce 13 | fmt.Println(helloMessage) 14 | } 15 | -------------------------------------------------------------------------------- /article_AB/embed_string3.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | _ "embed" 5 | "fmt" 6 | ) 7 | 8 | //go:embed lorem_ipsum.txt 9 | var loremIpsum string 10 | 11 | func main() { 12 | // pouziti retezce 13 | fmt.Println(loremIpsum) 14 | } 15 | -------------------------------------------------------------------------------- /article_AB/hello.txt: -------------------------------------------------------------------------------- 1 | Hello world! 2 | -------------------------------------------------------------------------------- /article_AB/more_strings1.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "embed" 5 | "fmt" 6 | "log" 7 | ) 8 | 9 | //go:embed hello.txt 10 | //go:embed lorem_ipsum.txt 11 | var f embed.FS 12 | 13 | func main() { 14 | data, err := f.ReadFile("lorem_ipsum.txt") 15 | if err != nil { 16 | log.Fatal(err) 17 | } 18 | 19 | // pouziti retezce 20 | fmt.Println(string(data)) 21 | } 22 | -------------------------------------------------------------------------------- /article_AB/more_strings2.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "embed" 5 | "fmt" 6 | "log" 7 | ) 8 | 9 | //go:embed *.txt 10 | var f embed.FS 11 | 12 | func main() { 13 | data, err := f.ReadFile("lorem_ipsum.txt") 14 | if err != nil { 15 | log.Fatal(err) 16 | } 17 | 18 | // pouziti retezce 19 | fmt.Println(string(data)) 20 | } 21 | -------------------------------------------------------------------------------- /article_AB/npe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tisnik/go-root/47f2392556c1755d24d07ec58b059dcc28f1e41c/article_AB/npe.jpg -------------------------------------------------------------------------------- /article_AD/go.mod: -------------------------------------------------------------------------------- 1 | module gocui-demos 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/jroimartin/gocui v0.5.0 // indirect 7 | github.com/mattn/go-runewidth v0.0.9 // indirect 8 | github.com/nsf/termbox-go v1.1.1 // indirect 9 | ) 10 | -------------------------------------------------------------------------------- /articles/README.md: -------------------------------------------------------------------------------- 1 | # Articles 2 | Articles about the Go programming language written for Root.cz 3 | 4 | ## List of articles 5 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/c-buffered/c.times: -------------------------------------------------------------------------------- 1 | 16 0.00 468 2 | 24 0.00 468 3 | 32 0.00 480 4 | 48 0.00 488 5 | 64 0.00 516 6 | 96 0.01 576 7 | 128 0.01 656 8 | 192 0.01 896 9 | 256 0.03 1228 10 | 384 0.06 1492 11 | 512 0.11 1492 12 | 768 0.25 1488 13 | 1024 0.44 1492 14 | 1536 1.00 1492 15 | 2048 1.75 1492 16 | 3072 3.99 1492 17 | 4096 7.10 1492 18 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/c-buffered/clean.sh: -------------------------------------------------------------------------------- 1 | rm *.o 2 | rm *.times 3 | rm *.ppm 4 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/c-unbuffered/c.times: -------------------------------------------------------------------------------- 1 | 16 0.00 480 2 | 24 0.00 476 3 | 32 0.00 476 4 | 48 0.00 476 5 | 64 0.01 480 6 | 96 0.02 476 7 | 128 0.03 476 8 | 192 0.08 480 9 | 256 0.13 480 10 | 384 0.29 480 11 | 512 0.52 476 12 | 768 1.18 472 13 | 1024 2.14 476 14 | 1536 4.91 480 15 | 2048 8.52 476 16 | 3072 19.66 476 17 | 4096 34.40 476 18 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/c-unbuffered/clean.sh: -------------------------------------------------------------------------------- 1 | rm *.o 2 | rm *.times 3 | rm *.ppm 4 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/c/c.times: -------------------------------------------------------------------------------- 1 | 16 0.00 480 2 | 24 0.00 476 3 | 32 0.00 480 4 | 48 0.00 480 5 | 64 0.00 476 6 | 96 0.00 476 7 | 128 0.00 480 8 | 192 0.01 480 9 | 256 0.03 480 10 | 384 0.06 480 11 | 512 0.11 480 12 | 768 0.25 480 13 | 1024 0.44 480 14 | 1536 1.01 480 15 | 2048 1.78 480 16 | 3072 4.03 480 17 | 4096 7.11 480 18 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/c/clean.sh: -------------------------------------------------------------------------------- 1 | rm *.o 2 | rm *.times 3 | rm *.ppm 4 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/c/test_c.sh: -------------------------------------------------------------------------------- 1 | sizes="16 24 32 48 64 96 128 192 256 384 512 768 1024 1536 2048 3072 4096" 2 | 3 | OUTFILE="c.times" 4 | PREFIX="mandelbrot" 5 | 6 | rm $OUTFILE 7 | 8 | for size in $sizes 9 | do 10 | echo $size 11 | echo -n "$size " >> $OUTFILE 12 | /usr/bin/time --output $OUTFILE --append --format "%e %M" ./mandelbrot $size $size 255 > "${PREFIX}_${size}_${size}.ppm" 13 | done 14 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-buffered/build.sh: -------------------------------------------------------------------------------- 1 | go build *.go 2 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-buffered/clean.sh: -------------------------------------------------------------------------------- 1 | rm *.times 2 | rm *.ppm 3 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-buffered/go.times: -------------------------------------------------------------------------------- 1 | 16 0.00 4972 2 | 24 0.00 4976 3 | 32 0.00 4976 4 | 48 0.00 4968 5 | 64 0.00 4972 6 | 96 0.00 4976 7 | 128 0.01 4972 8 | 192 0.02 4972 9 | 256 0.03 4972 10 | 384 0.07 4976 11 | 512 0.13 4972 12 | 768 0.29 4972 13 | 1024 0.50 4972 14 | 1536 1.14 4976 15 | 2048 2.03 4972 16 | 3072 4.56 4976 17 | 4096 8.07 4972 18 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-linewise/build.sh: -------------------------------------------------------------------------------- 1 | go build *.go 2 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-linewise/clean.sh: -------------------------------------------------------------------------------- 1 | rm *.times 2 | rm *.ppm 3 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-linewise/go.times: -------------------------------------------------------------------------------- 1 | 16 0.00 4976 2 | 24 0.00 4972 3 | 32 0.00 4976 4 | 48 0.00 4976 5 | 64 0.00 4972 6 | 96 0.00 4976 7 | 128 0.01 4976 8 | 192 0.02 4976 9 | 256 0.04 6996 10 | 384 0.07 4984 11 | 512 0.13 5012 12 | 768 0.29 7092 13 | 1024 0.50 7132 14 | 1536 1.19 11392 15 | 2048 2.09 17700 16 | 3072 4.73 32516 17 | 4096 8.44 55716 18 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-parallel-complex/build.sh: -------------------------------------------------------------------------------- 1 | go build *.go 2 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-parallel-complex/clean.sh: -------------------------------------------------------------------------------- 1 | rm *.times 2 | rm *.ppm 3 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-parallel/build.sh: -------------------------------------------------------------------------------- 1 | go build *.go 2 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-parallel/clean.sh: -------------------------------------------------------------------------------- 1 | rm *.times 2 | rm *.ppm 3 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go-parallel/go.times: -------------------------------------------------------------------------------- 1 | 16 0.00 4980 2 | 24 0.00 4980 3 | 32 0.00 4972 4 | 48 0.00 4976 5 | 64 0.00 4980 6 | 96 0.00 4984 7 | 128 0.01 4988 8 | 192 0.01 4996 9 | 256 0.02 5000 10 | 384 0.05 7072 11 | 512 0.08 7092 12 | 768 0.19 9216 13 | 1024 0.34 9252 14 | 1536 0.76 15644 15 | 2048 1.33 22004 16 | 3072 2.98 41008 17 | 4096 5.31 66328 18 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go/build.sh: -------------------------------------------------------------------------------- 1 | go build *.go 2 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go/clean.sh: -------------------------------------------------------------------------------- 1 | rm *.times 2 | rm *.ppm 3 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go/go.times: -------------------------------------------------------------------------------- 1 | 16 0.00 4948 2 | 24 0.00 4944 3 | 32 0.00 4948 4 | 48 0.00 4944 5 | 64 0.01 4944 6 | 96 0.02 4944 7 | 128 0.04 4940 8 | 192 0.09 6948 9 | 256 0.16 4944 10 | 384 0.36 4960 11 | 512 0.64 4944 12 | 768 1.41 4944 13 | 1024 2.54 6984 14 | 1536 5.66 4944 15 | 2048 10.08 4948 16 | 3072 23.61 4944 17 | 4096 40.53 4944 18 | -------------------------------------------------------------------------------- /benchmarks/mandelbrot/go/test_go.sh: -------------------------------------------------------------------------------- 1 | sizes="16 24 32 48 64 96 128 192 256 384 512 768 1024 1536 2048 3072 4096" 2 | 3 | OUTFILE="go.times" 4 | PREFIX="mandelbrot" 5 | 6 | rm $OUTFILE 7 | 8 | for size in $sizes 9 | do 10 | echo $size 11 | echo -n "$size " >> $OUTFILE 12 | /usr/bin/time --output $OUTFILE --append --format "%e %M" ./mandelbrot $size $size 255 > "${PREFIX}_${size}_${size}.ppm" 13 | done 14 | -------------------------------------------------------------------------------- /edn/go-edn-1/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-1/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-2/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-2/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-3/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-3/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-4/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-4/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-5/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-5/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-5/user.edn: -------------------------------------------------------------------------------- 1 | {:id 1, 2 | :user-name "Pepek", 3 | :surname "Vyskoč"} 4 | 5 | -------------------------------------------------------------------------------- /edn/go-edn-6/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-6/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-6/user.edn: -------------------------------------------------------------------------------- 1 | {:id 1, 2 | :user-name "Pepek", 3 | :surname "Vyskoč"} 4 | 5 | -------------------------------------------------------------------------------- /edn/go-edn-arrays/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-arrays/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-basic-types-1/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-basic-types-1/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-basic-types-2/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-basic-types-2/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-basic-types-3/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-basic-types-3/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /edn/go-edn-basic-types-4/go.mod: -------------------------------------------------------------------------------- 1 | module edn-demo 2 | 3 | go 1.13 4 | 5 | require olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 6 | -------------------------------------------------------------------------------- /edn/go-edn-basic-types-4/go.sum: -------------------------------------------------------------------------------- 1 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= 2 | olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= 3 | -------------------------------------------------------------------------------- /lang-statistic/stats.txt: -------------------------------------------------------------------------------- 1 | Python 35 2 | C 30 3 | Java 26 4 | Bash 19 5 | JavaScript 16 6 | C++ 13 7 | Ruby 8 8 | Perl 4 9 | Delphi 3 10 | TypeScript 3 11 | C# 2 12 | Haskell 2 13 | Vala 1 14 | 8086 assembly 1 15 | Magnetic needles 1 16 | Pascal 1 17 | Kotlin 1 18 | React 1 19 | PHP 1 20 | -------------------------------------------------------------------------------- /msgpack/benchmark/go.mod: -------------------------------------------------------------------------------- 1 | module msgpack-test 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/ugorji/go/codec v1.2.6 7 | gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 8 | ) 9 | -------------------------------------------------------------------------------- /msgpack/go.mod: -------------------------------------------------------------------------------- 1 | module msgpack-test 2 | 3 | go 1.17 4 | 5 | require github.com/ugorji/go/codec v1.2.6 6 | -------------------------------------------------------------------------------- /msgpack/go.sum: -------------------------------------------------------------------------------- 1 | github.com/ugorji/go v1.2.6 h1:tGiWC9HENWE2tqYycIqFTNorMmFRVhNwCpDOpWqnk8E= 2 | github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0= 3 | github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ= 4 | github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw= 5 | --------------------------------------------------------------------------------