openim-server/test/typecheck
Xinwei Xiong d356f7a035
feat(main): 🚀 Database Name Correction and S3 Module Int32 Overflow Fix with Go Routine Integration for Automated Checks and Script Optimization (#1799)
* feat: replace mongo database openIM_v3 to openim_v3

* openim-building-an-efficient-version-control-and-testing-workflow

* feat: complete openim source deployment rpc start timeout

* feat: optimize config

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>

* feat: add scripts format

* feat: use scripts format code

* fix cos and minio etc to typecheck

* feat: scripts make verify check ci

* fix: make file verify spelling

* fix: make file verify spelling

* Concurrent Type Checking and Cross-Platform Development in Go

* feat: add copyright make lint and format

* feat: add config examples file

Signed-off-by: Xinwei Xiong <3293172751@qq.com>

* feat: add config examples file

Signed-off-by: Xinwei Xiong <3293172751@qq.com>

---------

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
Signed-off-by: Xinwei Xiong <3293172751@qq.com>
2024-01-26 02:02:53 +00:00
..
README.md feat(main): 🚀 Database Name Correction and S3 Module Int32 Overflow Fix with Go Routine Integration for Automated Checks and Script Optimization (#1799) 2024-01-26 02:02:53 +00:00
go.mod feat(release-v3.4): Enhanced Build, Deployment, and Configuration Management for Optimized Performance and Automation (#1255) 2023-10-21 07:23:33 +00:00
go.sum Large refactoring projects: OpenIM automation, scripting, and openimctl refactoring (#825) 2023-08-23 09:09:51 +08:00
typecheck.go feat(main): 🚀 Database Name Correction and S3 Module Int32 Overflow Fix with Go Routine Integration for Automated Checks and Script Optimization (#1799) 2024-01-26 02:02:53 +00:00
typecheck_test.go ☀️ feat: Enhancing OpenIM with Integrated E2E Testing and CI/CD Enhancements (#1359) 2023-11-10 11:37:25 +00:00

README.md

OpenIM Typecheck: Cross-Platform Source Code Type Checking for Go

Introduction

OpenIM Typecheck is a robust tool designed for cross-platform source code type checking across all Go build platforms. This utility leverages Gos built-in parsing and type-check libraries (go/parser and go/types) to deliver efficient and reliable code analysis.

Advantages

  • Speed: A complete compilation with OpenIM can take approximately 3 minutes. In contrast, OpenIM Typecheck achieves this in mere seconds, significantly enhancing productivity.
  • Resource Efficiency: Unlike the typical requirement of over 40GB of RAM for standard processes, Typecheck operates effectively with less than 8GB of RAM. This reduction in resource consumption makes it highly suitable for a variety of systems, reducing overheads and facilitating smoother operations.

Implementation

OpenIM Typecheck employs Go's native parsing and type-checking libraries (go/parser and go/types). However, it's important to note that these libraries aren't identical to those used by the Go compiler. While occasional mismatches may occur, these libraries generally provide close approximations to the compiler's functionality, offering a reliable basis for type checking.

Error Handling

Typecheck's approach to error handling is pragmatic, focusing on practicality and build continuity.

Errors reported by go/types but not by go build:

  • Actual Errors (as per the specification):
    • These should ideally be rectified. If rectification is not feasible, such as in cases of ongoing work or external dependencies in the code, these errors can be overlooked.
      • Example: Unused variables within a closure.
  • False Positives:
    • These errors should be ignored and, where appropriate, reported upstream for resolution.
      • Example: Type mismatches between staging and generated types.

Errors reported by go build but not by us:

  • CGo-related errors, including both syntax and linker issues, are outside our scope.

Usage

Locally

To run Typecheck locally, simply use the following command:

make verify

Continuous Integration (CI)

In CI environments, Typecheck can be integrated into the workflow as follows:

- name: Typecheck
  run: make verify

This streamlined process facilitates efficient error detection and resolution, ensuring a robust and reliable build pipeline.

More to learn about typecheck share blog