github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/.github/scripts/format-go-code.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -eu
     4  
     5  FILEPATH="$1"
     6  
     7  gofmt -s -w "$FILEPATH"
     8  
     9  # https://github.com/daixiang0/gci
    10  if [[ "$FILEPATH" == *"tests/slo/"* ]]
    11  then
    12    gci write --skip-generated -s standard -s default -s "prefix(slo)" "$FILEPATH"
    13  elif [[ "$FILEPATH" == *"examples/"* ]]
    14  then
    15    gci write --skip-generated -s standard -s default -s "prefix(examples)" "$FILEPATH"
    16  else
    17    gci write --skip-generated -s standard -s default -s "prefix(github.com/ydb-platform/ydb-go-sdk/v3)" "$FILEPATH"
    18  fi
    19  
    20  
    21  # https://github.com/mvdan/gofumpt
    22  gofumpt -w "$FILEPATH"