Giter Club home page Giter Club logo

exercises-go's Introduction

github action status

hexlet-basics

Setup

Requirements

  • docker
  • docker compose V2
  • ruby >= 3.0.0
  • make

Steps

Add to /etc/hosts: 127.0.0.1 code-basics.test

Clone project

Some lsp servers are fully workable only when the root dir is the same inside and outside the container. That is why we set WORKDIR to /opt/projects/hexlet-basics. So, if it is possible, clone this project to that directory.

Prepare pulling image locally

  1. Open ./app/lib/docker_exercise_api.rb
  2. Find def self.download(lang_name) line
  3. Comment or remove ok = system("docker pull #{image_name(lang_name)}") line
  4. Add new line ok = true below

Run

make project-setup
make compose # run server
# open code-basics.test

make app-test # run tests

# load language
# make app-language-load L=php

make app-db-prepare # sometimes, when fixtures were changed

To manage loaded languages and set other settings, you need to sign in (login: [email protected], password: password)

Production

Kube access

# make k8s-macos-setup or make k8s-ubuntu-setup
export DIGITALOCEAN_ACCESS_TOKEN=<your token>
make local-cluster-setup

Deploy

  • Create new tag via command:

    make next-tag
  • Wait notification about ready tag in Slack channel #sideprojects-code-auto or wait Github Actions

  • Change version in k8s/hb-app-chart/values.yaml and then:

    make -C k8s helm-upgrade-app

Troubleshooting

I couldn't commit my changes

  • try to reinitialize your fork repository Read more
  • try to add RUN git config --global --add safe.directory ${PROJECT_ROOT} line after WORKDIR ${PROJECT_ROOT} in Dockerfile Read more

Hexlet Ltd. logo

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.

See most active contributors on hexlet-friends.

exercises-go's People

Contributors

amshkv avatar artsosed avatar ashikov avatar burenkov-anton avatar corsicanec82 avatar demetriusstorm avatar dzencot avatar elvilius avatar emp7yhead avatar fey avatar forpelevin avatar glebvarganov avatar helenone avatar ivanlemeshev avatar melodyn avatar mirkadev avatar mokevnin avatar ola-9 avatar peopl3s avatar romez avatar sgmdlt avatar shnurok42 avatar ssssank avatar svet-svet avatar vadimfilimonov avatar victorminsky avatar vladimirkondratenko avatar xaliion avatar zemlyanukhinnikita avatar zhabinka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exercises-go's Issues

20-array-slice-map/25-slice-copy/solution.go - лишнее копирование слайса

Привет! Зачем в данном случае делается копирование слайса через [:]? Ведь перед этим идет проверка, что maxLen не больше src слайса, следовательно, конструкция [:] тут лишняя, можно просто вернуть слайс cp, разве нет?

В задании на перебор мапы нет перебора мапы

Тут https://code-basics.com/ru/languages/go/lessons/map-for#comment-6325498439

Вот пример перебора мапы
idToName := map[int64]string{1: "Alex", 2: "Dan", 3: "George"}

// первый аргумент — ключ, второй — значение
for id, name := range idToName {
fmt.Println("id: ", id, "name: ", name)
}

А в решении перебираются слайсы, а не мапы

Go: Строки / Решение проходит проверку при использовании любого языкового пакета

Перенёс из PR-а #121 и немного дополнил.

Решение проходит проверку при использовании любого языкового пакета (например Arabic, Chinese).

package solution

import (
	"fmt"
	"strings"

	"golang.org/x/text/cases"
	"golang.org/x/text/language"
)

// BEGIN (write your solution here)
func Greetings(name string) string {

	name = strings.Trim(name," ")
	name = strings.ToLower(name) 
	name = cases.Title(language.Arabic).String(name)
	return fmt.Sprintf("Привет, %s!", name)
}

О cases не рассказывается в теории. Тут просто была пофикшена ошибка линтера, которая возникла вместе с обновлением версии Go. Думаю стоит вернуть strings.Title() и заигнорировать эту ошибку, так как в нашем случае она (вроде бы) не играет роли. Ошибка:

strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (SA1019) go-staticcheck

Пофиксить вывод кириллицы в OUTPUT

Урок
В задании требуется вернуть строку содержащую кириллические символы. При этом в выводе тестов, если решение не верно, мы увидим кракозябры.

Screenshot from 2022-08-29 17-37-49

Стоит грепнуть по всем урокам, возможно где-то еще есть подобный кейс.

Ошибка в задании Go: Логический тип

Задание:
"Реализуйте функцию IsValid(id int, text string) bool, которая проверяет, что переданный идентификатор id является положительным числом и текст text не пустой."

id - "положительным".
Тест не соответвует заданию a.True(IsValid(-10, "hey!"))

Либо изменить описание задания

Некорректное решение.

Кодбейсик курс Golang модуль 4.
В задании сказано создать переменную fullName и вывести её значение.
А в проверочном решении эта переменная не создается и все делается в обход её.
Ясно, что результат тот же, но мы же , по логике, сверяемся с решением учителя :задумчивость:
https://ru.code-basics.com/languages/go/lessons/variables#solution

Go: Руны 22/34 : Поправки к решению

Возможный вариант решения кажется более идиоматичным, избегает ненужной конверсии рун.

package solution

import (
	"unicode"
)

func isASCII(s string) bool {
	for i := 0; i < len(s); i++ {
		if s[i] > unicode.MaxASCII {
			return false
		}
	}
	return true
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.